From 3442019d941adb0f8f6f4bf7957e881daed32a41 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Tue, 28 Jun 2016 19:33:46 +0200 Subject: DM: Add F0299_CHAMPION_ApplyObjectModifiersToStatistics --- engines/dm/TODOs/todo.txt | 1 + engines/dm/champion.cpp | 135 ++++++++++++++++++++++++++++++++++++++++++++++ engines/dm/champion.h | 2 + 3 files changed, 138 insertions(+) (limited to 'engines/dm') diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt index 196d68f27c..0357673999 100644 --- a/engines/dm/TODOs/todo.txt +++ b/engines/dm/TODOs/todo.txt @@ -15,6 +15,7 @@ Todo: Rename GraphicIndice enum entires and have their name include GraphicIndice I forgot to add localization warnings Attend to Arnaud's notes on github + Attend to sev's notes on github Double check enums with hex literals, I think I screwed the regex when processing them Double check strcat, strstr usages, I might have messed them up in many places diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index c974a71d59..deae8b4247 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -132,6 +132,141 @@ Common::String ChampionMan::getStringFromInteger(uint16 val, bool padding, uint1 return result += valToStr; } +void ChampionMan::applyModifiersToStatistics(Champion* champ, ChampionSlot slotIndex, IconIndice iconIndex, int16 modifierFactor, Thing thing) { + int16 statIndex; + int16 modifier = 0; + ThingType thingType = thing.getType(); + if (((thingType == kWeaponThingType) || (thingType == kArmourThingType)) + && (slotIndex >= kChampionSlotReadyHand) + && (slotIndex <= kChampionSlotQuiverLine_1_1)) { + Weapon *weapon = (Weapon*)_vm->_dungeonMan->getThingData(thing); + Armour *armour = (Armour*)_vm->_dungeonMan->getThingData(thing); + if (((thingType == kWeaponThingType) && weapon->getCursed()) + || ((thingType == kArmourThingType) && armour->getCursed())) { + statIndex = kChampionStatLuck; + modifier = -3; + goto T0299044_ApplyModifier; + } + } + + statIndex = (ChampionStatisticType)thingType; // variable sharing + + if ((iconIndex == kIconIndiceJunkRabbitsFoot) && (slotIndex < kChampionSlotChest_1)) { + statIndex = kChampionStatLuck; + modifier = 10; + } else if (slotIndex == kChampionSlotActionHand) { + + if (iconIndex == kIconIndiceWeaponMaceOfOrder) { + statIndex = kChampionStatStrength; + modifier = 5; + } else { + + statIndex = kChampionStatMana; + if ((iconIndex >= kIconIndiceWeaponStaffOfClawsEmpty) && (iconIndex <= kIconIndiceWeaponStaffOfClawsFull)) { + modifier = 4; + } else if ((iconIndex >= kIconIndiceWeaponStaff) && (iconIndex <= kIconIndiceWeaponSceptreOfLyf)) { + switch (iconIndex) { + case kIconIndiceWeaponStaff: + modifier = 2; + break; + case kIconIndiceWeaponWand: + modifier = 1; + break; + case kIconIndiceWeaponTeowand: + modifier = 6; + break; + case kIconIndiceWeaponYewStaff: + modifier = 4; + break; + case kIconIndiceWeaponStaffOfManarStaffOfIrra: + modifier = 10; + break; + case kIconIndiceWeaponSnakeStaffCrossOfNeta: + modifier = 8; + break; + case kIconIndiceWeaponTheConduitSerpentStaff: + modifier = 16; + break; + case kIconIndiceWeaponDragonSpit: + modifier = 7; + break; + case kIconIndiceWeaponSceptreOfLyf: + modifier = 5; + break; + } + } else { + switch (iconIndex) { + case kIconIndiceWeaponDeltaSideSplitter: + modifier = 1; + break; + case kIconIndiceWeaponTheInquisitorDragonFang: + modifier = 2; + break; + case kIconIndiceWeaponVorpalBlade: + modifier = 4; + break; + } + } // end of else + + } + + } else if (slotIndex == kChampionSlotLegs) { + + if (iconIndex == kIconIndiceArmourPowertowers) { + statIndex = kChampionStatStrength; + modifier = 10; + } + + } else if (slotIndex == kChampionSlotHead) { + + if (iconIndex == kIconIndiceArmourCrownOfNerra) { + statIndex = kChampionStatWisdom; + modifier = 10; + } else if (iconIndex == kIconIndiceArmourDexhelm) { + statIndex = kChampionStatDexterity; + modifier = 10; + } + + } else if (slotIndex == kChampionSlotTorso) { + + if (iconIndex == kIconIndiceArmourFlamebain) { + statIndex = kChampionStatAntifire; + modifier = 12; + } else if (iconIndex == kIconIndiceArmourCloakOfNight) { + statIndex = kChampionStatDexterity; + modifier = 8; + } + + } else if (slotIndex == kChampionSlotNeck) { + + if ((iconIndex >= kIconIndiceJunkJewelSymalUnequipped) && (iconIndex <= kIconIndiceJunkJewelSymalEquipped)) { + statIndex = kChampionStatAntimagic; + modifier = 15; + } else if (iconIndex == kIconIndiceArmourCloakOfNight) { + statIndex = kChampionStatDexterity; + modifier = 8; + } else if (iconIndex == kIconIndiceJunkMoonstone) { + statIndex = kChampionStatMana; + modifier = 3; + } + + } + +T0299044_ApplyModifier: + if (modifier) { + modifier *= modifierFactor; + if (statIndex == kChampionStatMana) { + champ->_maxMana += modifier; + } else if (statIndex < kChampionStatAntifire + 1) { + for (uint16 statValIndex = kChampionStatMaximum; statValIndex <= kChampionStatMinimum; ++statValIndex) { + champ->getStatistic((ChampionStatisticType)statIndex, (ChampionStatisticValue)statValIndex) += modifier; + warning("BUG0_38"); + } + } + } + +} + ChampionIndex ChampionMan::getIndexInCell(ViewCell cell) { for (uint16 i = 0; i < _partyChampionCount; ++i) { if ((_champions[i]._cell == cell) && _champions[i]._currHealth) diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 8ea8a6d0a3..c61dbe4d70 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -457,6 +457,8 @@ public: void renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename uint16 getSkillLevel(ChampionIndex champIndex, ChampionSkill skillIndex);// @ F0303_CHAMPION_GetSkillLevel Common::String getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount); // @ F0288_CHAMPION_GetStringFromInteger + void applyModifiersToStatistics(Champion *champ, ChampionSlot slotIndex, IconIndice iconIndex, + int16 modifierFactor, Thing thing); // @ F0299_CHAMPION_ApplyObjectModifiersToStatistics }; -- cgit v1.2.3