1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Backup of last modifications in stack experience.

This commit is contained in:
DjWarmonger 2011-02-09 14:58:15 +00:00
parent 8a4187df16
commit 454beba90c
5 changed files with 72 additions and 4 deletions

View File

@ -21,11 +21,11 @@ FEAR Fear Has a chance to cause Fear on an enemy stack
FEARLESS Fearless Immune to Fear ability
CHARGE_IMMUNITY Immune to Charge Immune to Champion charge bonus
HEALER Healer Heals allied units
CATAPULT Catapult Attacks siege walls
CATAPULT Catapult Attacks siege walls
DRAGON_NATURE Dragon Creature has a Dragon Nature
NON_LIVING Non living Creature is immune to effects affecting Living units
UNDEAD Undead Creature is Undead
HATE Hates %s Does more damage to %s
HATE Hates %s Does %d% more damage to %s
DOUBLE_DAMAGE_CHANCE Death Blow Has %d% chance to deal double damage
MAGIC_RESISTANCE Magic Resistance Has %d% chance to resist enemy spell
SPELL_DAMAGE_REDUCTION Spell Resistance Damage from spells reduced 50%.

View File

@ -766,6 +766,8 @@ void CCreatureHandler::loadStackExp(stackExperience & b, std::string & src, int
b.type = Bonus::DOUBLE_DAMAGE_CHANCE; break;
case 'g':
b.type = Bonus::SPELL_DAMAGE_REDUCTION; break;
case 'R':
b.type = Bonus::ADDITIONAL_RETALIATION; break;
case 'f': //on-off skill
b.enable = true; //sometimes format is: 2 -> 0, 1 -> 1
@ -812,6 +814,54 @@ void CCreatureHandler::loadStackExp(stackExperience & b, std::string & src, int
break;
}
break;
case 'w': //specific spell immunities, enabled/disabled
b.enable = true;
switch (mod[0])
{
case 'B': //Blind
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 74;
break;
case 'H': //Hypnotize
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 60;
break;
case 'I': //Implosion
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 18;
break;
case 'K': //Berserk
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 59;
break;
case 'M': //Meteor Shower
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 23;
break;
case 'R': //Armageddon
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 26;
break;
case 'S': //Slow
b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 54;
break;
case '6': //problem - in VCMI value represents level, here it represents on/off
case '7':
case '8':
case '9':
b.type = Bonus::LEVEL_SPELL_IMMUNITY; //TODO - value can't be read afterwards
b.val = std::atoi(mod.c_str()) - 5;
break;
case ':':
b.type = Bonus::LEVEL_SPELL_IMMUNITY;
b.val = SPELL_LEVELS; //in case someone adds higher level spells?
break;
default:
tlog3 << "Not parsed bonus " << buf << mod << "\n";
}
break;
case 'i':
b.enable = true;
b.type = Bonus::NO_DISTANCE_PENALTY;
@ -820,6 +870,16 @@ void CCreatureHandler::loadStackExp(stackExperience & b, std::string & src, int
b.enable = true;
b.type = Bonus::NO_OBSTACLES_PENALTY;
break;
case 'a':
//case 'c': //some special abilities are threated as spells, will cause bugs
b.type = Bonus::SPELL_AFTER_ATTACK;
b.subtype = stringToNumber(mod);
break;
case 'h':
b.type= Bonus::HATE;
b.subtype = stringToNumber(mod);
break;
default:
tlog3 << "Not parsed bonus " << buf << mod << "\n";
break;
@ -874,6 +934,12 @@ void CCreatureHandler::loadMindImmunity(stackExperience & b, std::string & src,
}
}
int CCreatureHandler::stringToNumber(std::string & s)
{
boost::algorithm::replace_first(s,"#",""); //drop hash character
return std::atoi(s.c_str());
}
CCreatureHandler::~CCreatureHandler()
{
}

View File

@ -121,6 +121,7 @@ public:
void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i);
void loadStackExp(stackExperience & b, std::string & src, int & it);
void loadMindImmunity(stackExperience & b, std::string & src, int & it); //multiple bonuses at once
int stringToNumber(std::string & s);//help function for parsing CREXPBON.txt
bool isGood (si8 faction) const;
bool isEvil (si8 faction) const;

View File

@ -502,7 +502,8 @@ std::string CStackInstance::bonusToString(Bonus *bonus, bool description) const
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>(bonus->val));
break;
//Complex descriptions
case Bonus::HATE: //TODO: customize damage percent
case Bonus::HATE:
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>(bonus->val));
boost::algorithm::replace_first(text, "%s", VLC->creh->creatures[bonus->subtype]->namePl);
break;
case Bonus::SPELL_IMMUNITY:

View File

@ -87,7 +87,7 @@ namespace PrimarySkill
BONUS_NAME(UNLIMITED_RETALIATIONS) \
BONUS_NAME(NO_MELEE_PENALTY) \
BONUS_NAME(JOUSTING) /*for champions*/ \
BONUS_NAME(HATE) /*eg. angels hate devils, subtype - ID of hated creature*/ \
BONUS_NAME(HATE) /*eg. angels hate devils, subtype - ID of hated creature, val - damage bonus percent */ \
BONUS_NAME(KING1) \
BONUS_NAME(KING2) \
BONUS_NAME(KING3) \