mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Converted bonusnames.txt to a json file.
This commit is contained in:
parent
b853df76ba
commit
16fcd025a7
56
config/bonusnames.json
Normal file
56
config/bonusnames.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"bonuses":
|
||||
[
|
||||
{ "id": "ADDITIONAL_RETALIATION", "name": "Additional retaliations", "description": "May Retaliate %d extra times" },
|
||||
{ "id": "ATTACKS_ALL_ADJACENT", "name": "Attack all around", "description": "Attacks all adjacent enemies" },
|
||||
{ "id": "RETURN_AFTER_STRIKE", "name": "Attack and Return", "description": "Returns after melee attack" },
|
||||
{ "id": "SPELL_RESISTANCE_AURA", "name": "Aura of Resistance", "description": "Nearby stacks get %d% resistance" },
|
||||
{ "id": "TWO_HEX_ATTACK_BREATH", "name": "Breath", "description": "Breath Attack (2-hex range)" },
|
||||
{ "id": "SPELL_AFTER_ATTACK", "name": "Caster - %s", "description": "%d% chance to cast after attack" },
|
||||
{ "id": "SPELL_BEFORE_ATTACK", "name": "Caster - %s", "description": "%d% chance to cast before attack" },
|
||||
{ "id": "CATAPULT", "name": "Catapult", "description": "Attacks siege walls" },
|
||||
{ "id": "JOUSTING", "name": "Champion Charge", "description": "+5% damage per hex travelled" },
|
||||
{ "id": "DOUBLE_DAMAGE_CHANCE", "name": "Death Blow", "description": "%d% chance for double damage" },
|
||||
{ "id": "DEFENSIVE_STANCE", "name": "Defense Bonus", "description": "+%d Defense when defending" },
|
||||
{ "id": "ADDITIONAL_ATTACK", "name": "Double Strike", "description": "Attacks twice" },
|
||||
{ "id": "DRAGON_NATURE", "name": "Dragon", "description": "Creature has a Dragon Nature" },
|
||||
{ "id": "LIFE_DRAIN", "name": "Drain life", "description": "Drains life equal to damage dealt" },
|
||||
{ "id": "FEAR", "name": "Fear", "description": "Causes Fear on an enemy stack" },
|
||||
{ "id": "FEARLESS", "name": "Fearless", "description": "Immune to Fear ability" },
|
||||
{ "id": "FLYING", "name": "Fly", "description": "Can Fly (ignores obstacles)" },
|
||||
{ "id": "HATE", "name": "Hates %s", "description": "Does %d% more damage" },
|
||||
{ "id": "HEALER", "name": "Healer", "description": "Heals allied units" },
|
||||
{ "id": "SPELL_IMMUNITY", "name": "Immune to %s", "description": "" },
|
||||
{ "id": "CHARGE_IMMUNITY", "name": "Immune to Charge", "description": "Immune to Champion charge" },
|
||||
{ "id": "MANA_CHANNELING", "name": "Magic Channel %d%", "description": "Gives mana spent by enemy" },
|
||||
{ "id": "CHANGES_SPELL_COST_FOR_ENEMY", "name": "Magic Damper (%d)", "description": "Increase Cost of enemy spells" },
|
||||
{ "id": "MAGIC_MIRROR", "name": "Magic Mirror (%d%)", "description": "Redirects offensive spell to enemy" },
|
||||
{ "id": "MAGIC_RESISTANCE", "name": "Magic Resistance", "description": "%d% chance to resist enemy spell" },
|
||||
{ "id": "NO_DISTANCE_PENALTY", "name": "No distance penalty", "description": "Full damage from any distance" },
|
||||
{ "id": "NO_MELEE_PENALTY", "name": "No melee penalty", "description": "Creature has no Melee Penalty" },
|
||||
{ "id": "NO_OBSTACLES_PENALTY", "name": "No obstacle penalty", "description": "Creature has no Obstacle Penalty" },
|
||||
{ "id": "BLOCKS_RETALIATION", "name": "No retaliation", "description": "Enemy cannot Retaliate" },
|
||||
{ "id": "NON_LIVING", "name": "Non living", "description": "Immunity to many effects" },
|
||||
{ "id": "SELF_LUCK", "name": "Positive luck", "description": "Always has Positive Luck" },
|
||||
{ "id": "SELF_MORALE", "name": "Positive morale", "description": "Always has Positive Morale" },
|
||||
{ "id": "SHOOTER", "name": "Ranged", "description": "Creature can shoot" },
|
||||
{ "id": "CHANGES_SPELL_COST_FOR_ALLY", "name": "Reduce Casting Cost (%d)", "description": "Reduce Casting Cost for hero" },
|
||||
{ "id": "ENEMY_DEFENCE_REDUCTION", "name": "Reduce Enemy Defense (%d%)", "description": "Reduces Defense for one attack" },
|
||||
{ "id": "FULL_HP_REGENERATION", "name": "Regeneration", "description": "May Regenerate full Health" },
|
||||
{ "id": "HP_REGENERATION", "name": "Regeneration", "description": "Heals %d hit points every round" },
|
||||
{ "id": "FREE_SHOOTING", "name": "Shoot Close", "description": "Can shoot in Close Combat" },
|
||||
{ "id": "LEVEL_SPELL_IMMUNITY", "name": "Spell immunity 1-%d", "description": "Immune to spells levels 1-%d" },
|
||||
{ "id": "SPELL_DAMAGE_REDUCTION", "name": "Spell Resistance", "description": "Damage from spells reduced %d%." },
|
||||
{ "id": "THREE_HEADED_ATTACK", "name": "Three-headed attack", "description": "Attacks three adjacent units" },
|
||||
{ "id": "UNDEAD", "name": "Undead", "description": "Creature is Undead" },
|
||||
{ "id": "UNLIMITED_RETALIATIONS", "name": "Unlimited retaliations", "description": "Retaliate any number of attacks" },
|
||||
{ "id": "DEATH_STARE", "name": "Death Stare (%d%)", "description": "Chance to kill single creature" },
|
||||
{ "id": "FIRE_IMMUNITY", "name": "Immune to Fire", "description": "" },
|
||||
{ "id": "WATER_IMMUNITY", "name": "Immune to Water", "description": "" },
|
||||
{ "id": "AIR_IMMUNITY", "name": "Immune to Air", "description": "" },
|
||||
{ "id": "EARTH_IMMUNITY", "name": "Immune to Earth", "description": "" },
|
||||
{ "id": "DIRECT_DAMAGE_IMMUNITY", "name": "Direct Damage Immunity", "description": "Immune to direct damage spells" },
|
||||
{ "id": "RECEPTIVE", "name": "Receptive", "description": "No Immunity to Friendly Spells" },
|
||||
{ "id": "REBIRTH", "name": "Rebirth (%d%)", "description": "Stack will rise after death" }
|
||||
]
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
Bonus Name (30 characters?) Description (30)
|
||||
ADDITIONAL_RETALIATION Additional retaliations May Retaliate %d extra times
|
||||
ATTACKS_ALL_ADJACENT Attack all around Attacks all adjacent enemies
|
||||
RETURN_AFTER_STRIKE Attack and Return Returns after melee attack
|
||||
SPELL_RESISTANCE_AURA Aura of Resistance Nearby stacks get %d% resistance
|
||||
TWO_HEX_ATTACK_BREATH Breath Breath Attack (2-hex range)
|
||||
SPELL_AFTER_ATTACK Caster - %s %d% chance to cast after attack
|
||||
SPELL_BEFORE_ATTACK Caster - %s %d% chance to cast before attack
|
||||
CATAPULT Catapult Attacks siege walls
|
||||
JOUSTING Champion Charge +5% damage per hex travelled
|
||||
DOUBLE_DAMAGE_CHANCE Death Blow %d% chance for double damage
|
||||
DEFENSIVE_STANCE Defense Bonus +%d Defense when defending
|
||||
ADDITIONAL_ATTACK Double Strike Attacks twice
|
||||
DRAGON_NATURE Dragon Creature has a Dragon Nature
|
||||
LIFE_DRAIN Drain life Drains life equal to damage dealt
|
||||
FEAR Fear Causes Fear on an enemy stack
|
||||
FEARLESS Fearless Immune to Fear ability
|
||||
FLYING Fly Can Fly (ignores obstacles)
|
||||
HATE Hates %s Does %d% more damage
|
||||
HEALER Healer Heals allied units
|
||||
SPELL_IMMUNITY Immune to %s
|
||||
CHARGE_IMMUNITY Immune to Charge Immune to Champion charge
|
||||
MANA_CHANNELING Magic Channel %d% Gives mana spent by enemy
|
||||
CHANGES_SPELL_COST_FOR_ENEMY Magic Damper (%d) Increase Cost of enemy spells
|
||||
MAGIC_MIRROR Magic Mirror (%d%) Redirects offensive spell to enemy
|
||||
MAGIC_RESISTANCE Magic Resistance %d% chance to resist enemy spell
|
||||
NO_DISTANCE_PENALTY No distance penalty Full damage from any distance
|
||||
NO_MELEE_PENALTY No melee penalty Creature has no Melee Penalty
|
||||
NO_OBSTACLES_PENALTY No obstacle penalty Creature has no Obstacle Penalty
|
||||
BLOCKS_RETALIATION No retaliation Enemy cannot Retaliate
|
||||
NON_LIVING Non living Immunity to many effects
|
||||
SELF_LUCK Positive luck Always has Positive Luck
|
||||
SELF_MORALE Positive morale Always has Positive Morale
|
||||
SHOOTER Ranged Creature can shoot
|
||||
CHANGES_SPELL_COST_FOR_ALLY Reduce Casting Cost (%d) Reduce Casting Cost for hero
|
||||
ENEMY_DEFENCE_REDUCTION Reduce Enemy Defense (%d%) Reduces Defense for one attack
|
||||
FULL_HP_REGENERATION Regeneration May Regenerate full Health
|
||||
HP_REGENERATION Regeneration Heals %d hit points every round
|
||||
FREE_SHOOTING Shoot Close Can shoot in Close Combat
|
||||
LEVEL_SPELL_IMMUNITY Spell immunity 1-%d Immune to spells levels 1-%d
|
||||
SPELL_DAMAGE_REDUCTION Spell Resistance Damage from spells reduced %d%.
|
||||
THREE_HEADED_ATTACK Three-headed attack Attacks three adjacent units
|
||||
UNDEAD Undead Creature is Undead
|
||||
UNLIMITED_RETALIATIONS Unlimited retaliations Retaliate any number of attacks
|
||||
DEATH_STARE Death Stare (%d%) Chance to kill single creature
|
||||
FIRE_IMMUNITY Immune to Fire
|
||||
WATER_IMMUNITY Immune to Water
|
||||
AIR_IMMUNITY Immune to Air
|
||||
EARTH_IMMUNITY Immune to Earth
|
||||
DIRECT_DAMAGE_IMMUNITY Direct Damage Immunity Immune to direct damage spells
|
||||
RECEPTIVE Receptive No Immunity to Friendly Spells
|
||||
REBIRTH Rebirth (%d%) Stack will rise after death
|
@ -504,35 +504,25 @@ void CCreatureHandler::loadCreatures()
|
||||
factionToTurretCreature[c->faction] = creatureID;
|
||||
}
|
||||
|
||||
std::ifstream ifs;
|
||||
std::string dump2;
|
||||
|
||||
buildBonusTreeForTiers();
|
||||
loadAnimationInfo();
|
||||
|
||||
//reading creature ability names
|
||||
ifs.open(DATA_DIR "/config/bonusnames.txt");
|
||||
{
|
||||
std::string buf2, buf3, line;
|
||||
std::map<std::string,int>::const_iterator it;
|
||||
getline(ifs, line); //skip 1st line
|
||||
while(!ifs.eof())
|
||||
{
|
||||
getline(ifs, buf, '\t');
|
||||
getline(ifs, buf2, '\t');
|
||||
getline(ifs, buf3);
|
||||
const JsonNode config2(DATA_DIR "/config/bonusnames.json");
|
||||
const JsonVector &bonuses_vec = config2["bonuses"].Vector();
|
||||
|
||||
if (ifs.eof() || ifs.fail())
|
||||
break;
|
||||
for (JsonVector::const_iterator it = bonuses_vec.begin(); it!=bonuses_vec.end(); ++it) {
|
||||
const JsonNode &bonus = *it;
|
||||
std::map<std::string,int>::const_iterator it_map;
|
||||
std::string bonusID = bonus["id"].String();
|
||||
|
||||
it = bonusNameMap.find(buf);
|
||||
if (it != bonusNameMap.end())
|
||||
stackBonuses[it->second] = std::pair<std::string, std::string>(buf2,buf3);
|
||||
else
|
||||
tlog2 << "Bonus " << buf << " not recognized, ignoring\n";
|
||||
it_map = bonusNameMap.find(bonusID);
|
||||
if (it_map != bonusNameMap.end()) {
|
||||
stackBonuses[it_map->second] = std::pair<std::string, std::string>(bonus["name"].String(), bonus["description"].String());
|
||||
} else
|
||||
tlog2 << "Bonus " << bonusID << " not recognized, ignoring\n";
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
|
||||
//handle magic resistance secondary skill premy, potentialy may be buggy
|
||||
std::map<TBonusType, std::pair<std::string, std::string> >::iterator it = stackBonuses.find(Bonus::MAGIC_RESISTANCE);
|
||||
stackBonuses[Bonus::SECONDARY_SKILL_PREMY] = std::pair<std::string, std::string>(it->second.first, it->second.second);
|
||||
@ -550,6 +540,7 @@ void CCreatureHandler::loadCreatures()
|
||||
b.additionalInfo = 0;
|
||||
b.turnsRemain = 0;
|
||||
BonusList bl;
|
||||
std::string dump2;
|
||||
|
||||
loadToIt (dump2, buf, it, 3); //ignore first line
|
||||
loadToIt (dump2, buf, it, 4); //ignore index
|
||||
|
Loading…
Reference in New Issue
Block a user