Energy unit changes: energy units recharge rate adjusted to offer a better challenge to the player, and naval/extra energy unit purchase behaviour more flexible (see resolution of Bug #13507, Naval Energy Unit bug in berlios). Warnings added if energy units are going to be removed.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1544 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
8a219606a2
commit
cc9f7cd857
@ -856,6 +856,7 @@
|
||||
"equip-no-equipment-available-for-purchase" = "No equipment available for purchase.";
|
||||
"equip-repair-@" = " Repair:%@";
|
||||
"upgradeinfo-@-price-is-for-repairing" = "%@ (Price is for repairing the existing system).";
|
||||
"@-will-replace-other-energy" ="%@ (The installed energy recharge unit will be removed from the ship and sold for scrap).";
|
||||
"forward-facing-string" = " Forward ";
|
||||
"aft-facing-string" = " Aft ";
|
||||
"port-facing-string" = " Port ";
|
||||
|
@ -80,10 +80,6 @@
|
||||
<string>Naval Energy Unit</string>
|
||||
<string>EQ_NAVAL_ENERGY_UNIT</string>
|
||||
<string>A special improved efficiency energy recharge unit, as supplied to Navy vessels.</string>
|
||||
<dict>
|
||||
<key>incompatible_with_equipment</key>
|
||||
<string>EQ_ENERGY_UNIT</string>
|
||||
</dict>
|
||||
</array>
|
||||
<array>
|
||||
<integer>9</integer>
|
||||
|
@ -561,6 +561,7 @@ waitingForStickCallback: 1;
|
||||
|
||||
- (BOOL) mountMissile:(ShipEntity *)missile;
|
||||
|
||||
- (OOEnergyUnitType) installedEnergyUnitType;
|
||||
- (OOEnergyUnitType) energyUnitType;
|
||||
|
||||
- (BOOL) fireEnergyBomb;
|
||||
|
@ -326,12 +326,12 @@ static PlayerEntity *sSharedPlayer = nil;
|
||||
if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"])
|
||||
{
|
||||
[result setBool:YES forKey:@"has_energy_unit"];
|
||||
[result setInteger:ENERGY_UNIT_NAVAL forKey:@"energy_unit"];
|
||||
[result setInteger:OLD_ENERGY_UNIT_NAVAL forKey:@"energy_unit"];
|
||||
}
|
||||
else if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"])
|
||||
{
|
||||
[result setBool:YES forKey:@"has_energy_unit"];
|
||||
[result setInteger:ENERGY_UNIT_NORMAL forKey:@"energy_unit"];
|
||||
[result setInteger:OLD_ENERGY_UNIT_NORMAL forKey:@"energy_unit"];
|
||||
}
|
||||
|
||||
NSMutableArray* missileRoles = [NSMutableArray arrayWithCapacity:max_missiles];
|
||||
@ -512,20 +512,20 @@ static PlayerEntity *sSharedPlayer = nil;
|
||||
if ([dict boolForKey:@"has_fuel_injection"]) [self addEquipmentItem:@"EQ_FUEL_INJECTION"];
|
||||
|
||||
// Legacy energy unit type -> energy unit equipment item
|
||||
if ([dict boolForKey:@"has_energy_unit"] && [self energyUnitType] == ENERGY_UNIT_NONE)
|
||||
if ([dict boolForKey:@"has_energy_unit"] && [self installedEnergyUnitType] == ENERGY_UNIT_NONE)
|
||||
{
|
||||
OOEnergyUnitType eType = [dict intForKey:@"energy_unit" defaultValue:ENERGY_UNIT_NORMAL];
|
||||
switch (eType)
|
||||
{
|
||||
case ENERGY_UNIT_NORMAL:
|
||||
case OLD_ENERGY_UNIT_NORMAL:
|
||||
[self addEquipmentItem:@"EQ_ENERGY_UNIT"];
|
||||
break;
|
||||
|
||||
case ENERGY_UNIT_NAVAL:
|
||||
case OLD_ENERGY_UNIT_NAVAL:
|
||||
[self addEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"];
|
||||
break;
|
||||
|
||||
case ENERGY_UNIT_NONE:
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1267,7 +1267,7 @@ double scoopSoundPlayTime = 0.0;
|
||||
|
||||
if (energy < maxEnergy)
|
||||
{
|
||||
double energy_multiplier = 1.0 + 0.1 * [self energyUnitType]; // 1.5x recharge with normal energy unit, 2x with naval!
|
||||
double energy_multiplier = 1.0 + 0.1 * [self installedEnergyUnitType]; // 1.8x recharge with normal energy unit, 2.6x with naval!
|
||||
energy += energy_recharge_rate * energy_multiplier * delta_t;
|
||||
if (energy > maxEnergy)
|
||||
energy = maxEnergy;
|
||||
@ -2716,15 +2716,22 @@ double scoopSoundPlayTime = 0.0;
|
||||
}
|
||||
|
||||
|
||||
- (OOEnergyUnitType) installedEnergyUnitType
|
||||
{
|
||||
if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
|
||||
if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
|
||||
return ENERGY_UNIT_NONE;
|
||||
}
|
||||
|
||||
- (OOEnergyUnitType) energyUnitType
|
||||
{
|
||||
if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
|
||||
if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
|
||||
|
||||
if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NAVAL_DAMAGED;
|
||||
if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NORMAL_DAMAGED;
|
||||
return ENERGY_UNIT_NONE;
|
||||
}
|
||||
|
||||
|
||||
- (float) heatInsulation
|
||||
{
|
||||
return [self hasHeatShield] ? 2.0 : 1.0;
|
||||
@ -4894,6 +4901,8 @@ static int last_outfitting_index;
|
||||
NSString* eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eq_key];
|
||||
if ([self hasEquipmentItem:eq_key_damaged])
|
||||
desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
|
||||
else if([eq_key hasSuffix:@"ENERGY_UNIT"] && ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"] || [self hasEquipmentItem:@"EQ_ENERGY_UNIT"] || [self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
|
||||
desc = [NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
|
||||
[gui addLongText:desc startingAtRow:GUI_ROW_EQUIPMENT_DETAIL align:GUI_ALIGN_LEFT];
|
||||
}
|
||||
}
|
||||
@ -5211,13 +5220,18 @@ static int last_outfitting_index;
|
||||
[self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"];
|
||||
tradeIn = [UNIVERSE getPriceForWeaponSystemWithKey:@"EQ_NAVAL_ENERGY_UNIT"] / 2; // 50 % refund
|
||||
break;
|
||||
|
||||
case ENERGY_UNIT_NAVAL_DAMAGED :
|
||||
[self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"];
|
||||
tradeIn = [UNIVERSE getPriceForWeaponSystemWithKey:@"EQ_NAVAL_ENERGY_UNIT"] / 4; // half of the working one
|
||||
case ENERGY_UNIT_NORMAL :
|
||||
[self removeEquipmentItem:@"EQ_ENERGY_UNIT"];
|
||||
tradeIn = [UNIVERSE getPriceForWeaponSystemWithKey:@"EQ_ENERGY_UNIT"] * 3 / 4; // 75 % refund
|
||||
tradeIn = [UNIVERSE getPriceForWeaponSystemWithKey:@"EQ_ENERGY_UNIT"] * 3 / 4; // 75 % refund
|
||||
break;
|
||||
case ENERGY_UNIT_NORMAL_DAMAGED :
|
||||
[self removeEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"];
|
||||
tradeIn = [UNIVERSE getPriceForWeaponSystemWithKey:@"EQ_ENERGY_UNIT"] * 3 / 8; // half of the working one
|
||||
break;
|
||||
|
||||
case ENERGY_UNIT_NONE :
|
||||
default :
|
||||
break;
|
||||
}
|
||||
@ -6381,7 +6395,7 @@ OOSound* burnersound;
|
||||
OOLog(@"dumpState.playerEntity", @"Shield: %g fore, %g aft", forward_weapon, aft_shield);
|
||||
OOLog(@"dumpState.playerEntity", @"Alert level: %u, flags: %#x", alertFlags, alertCondition);
|
||||
OOLog(@"dumpState.playerEntity", @"Missile status: %i", missile_status);
|
||||
OOLog(@"dumpState.playerEntity", @"Energy unit: %@", EnergyUnitTypeToString([self energyUnitType]));
|
||||
OOLog(@"dumpState.playerEntity", @"Energy unit: %@", EnergyUnitTypeToString([self installedEnergyUnitType]));
|
||||
OOLog(@"dumpState.playerEntity", @"Fuel leak rate: %g", fuel_leak_rate);
|
||||
OOLog(@"dumpState.playerEntity", @"Trumble count: %u", trumbleCount);
|
||||
|
||||
|
@ -360,6 +360,10 @@ NSString *EnergyUnitTypeToString(OOEnergyUnitType unit)
|
||||
CASE(ENERGY_UNIT_NONE);
|
||||
CASE(ENERGY_UNIT_NORMAL);
|
||||
CASE(ENERGY_UNIT_NAVAL);
|
||||
CASE(ENERGY_UNIT_NORMAL_DAMAGED);
|
||||
CASE(ENERGY_UNIT_NAVAL_DAMAGED);
|
||||
default:
|
||||
return @"Unsupported energy unit";
|
||||
}
|
||||
|
||||
return @"Unknown energy unit";
|
||||
@ -371,6 +375,8 @@ OOEnergyUnitType StringToEnergyUnitType(NSString *string)
|
||||
REVERSE_CASE(ENERGY_UNIT_NONE);
|
||||
REVERSE_CASE(ENERGY_UNIT_NORMAL);
|
||||
REVERSE_CASE(ENERGY_UNIT_NAVAL);
|
||||
REVERSE_CASE(ENERGY_UNIT_NORMAL_DAMAGED);
|
||||
REVERSE_CASE(ENERGY_UNIT_NAVAL_DAMAGED);
|
||||
|
||||
return ENERGY_UNIT_NONE;
|
||||
}
|
||||
|
@ -283,8 +283,12 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
ENERGY_UNIT_NONE,
|
||||
ENERGY_UNIT_NORMAL = 15,
|
||||
ENERGY_UNIT_NAVAL = 20
|
||||
ENERGY_UNIT_NORMAL_DAMAGED,
|
||||
ENERGY_UNIT_NAVAL_DAMAGED,
|
||||
OLD_ENERGY_UNIT_NORMAL =15,
|
||||
OLD_ENERGY_UNIT_NAVAL = 20,
|
||||
ENERGY_UNIT_NORMAL = 8,
|
||||
ENERGY_UNIT_NAVAL = 16
|
||||
} OOEnergyUnitType;
|
||||
|
||||
|
||||
|
@ -224,17 +224,17 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
|
||||
|
||||
planetinfo = [[ResourceManager dictionaryFromFilesNamed:@"planetinfo.plist" inFolder:@"Config" mergeMode:MERGE_SMART cache:YES] retain];
|
||||
|
||||
pirateVictimRoles = [[NSSet alloc] initWithArray:[ResourceManager arrayFromFilesNamed:@"pirate-victim-roles.plist" inFolder:@"Config" andMerge:YES]];
|
||||
|
||||
equipmentdata = [[ResourceManager arrayFromFilesNamed:@"equipment.plist" inFolder:@"Config" andMerge:YES] retain];
|
||||
|
||||
localPlanetInfoOverrides = [[NSMutableDictionary alloc] initWithCapacity:8];
|
||||
|
||||
missiontext = [[ResourceManager dictionaryFromFilesNamed:@"missiontext.plist" inFolder:@"Config" andMerge:YES] retain];
|
||||
|
||||
equipmentdata = [[ResourceManager arrayFromFilesNamed:@"equipment.plist" inFolder:@"Config" andMerge:YES] retain];
|
||||
|
||||
demo_ships = [[ResourceManager arrayFromFilesNamed:@"demoships.plist" inFolder:@"Config" andMerge:YES] retain];
|
||||
demo_ship_index = 0;
|
||||
|
||||
pirateVictimRoles = [[NSSet alloc] initWithArray:[ResourceManager arrayFromFilesNamed:@"pirate-victim-roles.plist" inFolder:@"Config" andMerge:YES]];
|
||||
|
||||
breakPatternCounter = 0;
|
||||
|
||||
cachedSun = nil;
|
||||
|
Loading…
x
Reference in New Issue
Block a user