1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

Moved combo artifacts to config file, they are now handled by string id.

TODO: use same solution for new mod artifacts.
This commit is contained in:
DjWarmonger 2012-12-25 19:04:15 +00:00
parent 743a0fc3f4
commit d50f9c8d34
3 changed files with 125 additions and 82 deletions

View File

@ -2324,7 +2324,16 @@
}
],
"id" : 129,
"type" : "Hero"
"type" : "Hero",
"components":
[
"armorOfWonder",
"sandalsOfTheSaint",
"celestialNecklaceOfBliss",
"lionsShieldOfCourage",
"swordOfJudgement",
"helmOfHeavenlyEnlightenment"
]
},
"cloakOfTheUndeadKing":
{
@ -2340,7 +2349,13 @@
}
],
"id" : 130,
"type" : "Hero"
"type" : "Hero",
"components":
[
"amuletOfTheUndertaker",
"vampiresCowl",
"deadMansBoots"
]
},
"elixirOfLife":
{
@ -2365,7 +2380,13 @@
}
],
"id" : 131,
"type" : "Hero"
"type" : "Hero",
"components":
[
"ringOfVitality",
"ringOfLife",
"vialOfLifeblood"
]
},
"armorOfTheDamned":
{
@ -2408,12 +2429,27 @@
}
],
"id" : 132,
"type" : "Hero"
"type" : "Hero",
"components":
[
"blackshardOfTheDeadKnight",
"shieldOfTheYawningDead",
"skullHelmet",
"ribCage"
]
},
"statueOfLegion": //TODO: implement
{
"id" : 133,
"type" : "Hero"
"type" : "Hero",
"components":
[
"legsOfLegion",
"loinsOfLegion",
"torsoOfLegion",
"armsOfLegion",
"headOfLegion"
]
},
"powerOfTheDragonFather": //TODO: add stat bonus
{
@ -2429,7 +2465,19 @@
}
],
"id" : 134,
"type" : "Hero"
"type" : "Hero",
"components":
[
"quietEyeOfTheDragon",
"redDragonFlameTongue",
"dragonScaleShield",
"dragonScaleArmor",
"dragonboneGreaves",
"dragonWingTabard",
"necklaceOfDragonteeth",
"crownOfDragontooth",
"stillEyeOfTheDragon"
]
},
"titansThunder":
{
@ -2445,7 +2493,14 @@
}
],
"id" : 135,
"type" : "Hero"
"type" : "Hero",
"components":
[
"titansGladius",
"sentinelsShield",
"thunderHelmet",
"titansCuirass"
]
},
"admiralsHat":
{
@ -2461,7 +2516,12 @@
}
],
"id" : 136,
"type" : "Hero"
"type" : "Hero",
"components":
[
"necklaceOfOceanGuidance",
"seaCaptainsHat"
]
},
"bowOfTheSharpshooter": //TODO: limiters
{
@ -2498,7 +2558,13 @@
}
],
"id" : 137,
"type" : "Hero"
"type" : "Hero",
"components":
[
"bowOfElvenCherrywood",
"bowstringOfTheUnicornsMane",
"angelFeatherArrows"
]
},
"wizardsWell":
{
@ -2514,7 +2580,13 @@
}
],
"id" : 138,
"type" : "Hero"
"type" : "Hero",
"components":
[
"charmOfMana",
"talismanOfMana",
"mysticOrbOfMana"
]
},
"ringOfTheMagi":
{
@ -2530,7 +2602,13 @@
}
],
"id" : 139,
"type" : "Hero"
"type" : "Hero",
"components":
[
"collarOfConjuring",
"ringOfConjuring",
"capeOfConjuring"
]
},
"cornucopia":
{
@ -2573,7 +2651,13 @@
}
],
"id" : 140,
"type" : "Hero"
"type" : "Hero",
"components":
[
"everflowingCrystalCloak",
"ringOfInfiniteGems",
"everpouringVialOfMercury",
"inexhaustibleCartOfOre" ]
},
"magicWand":
{
@ -2988,7 +3072,14 @@
"barbarianLordsAxeOfFerocity": //TODO: implement
{
"id" : 158,
"type" : "Hero"
"type" : "Hero",
"components":
[
"ogresClubOfHavoc",
"targOfTheRampagingOgre",
"crownOfTheSupremeMagi",
"tunicOfTheCyclopsKing"
]
},
"dragonheart":
{

View File

@ -334,75 +334,6 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
if(onlyTxt)
continue;
// Fill in information about combined artifacts. Should perhaps be moved to a config file?
switch (nart.id)
{
case 129: // Angelic Alliance
nart.constituents = new std::vector<ui32>();
*nart.constituents += 31, 32, 33, 34, 35, 36;
break;
case 130: // Cloak of the Undead King
nart.constituents = new std::vector<ui32>();
*nart.constituents += 54, 55, 56;
break;
case 131: // Elixir of Life
nart.constituents = new std::vector<ui32>();
*nart.constituents += 94, 95, 96;
break;
case 132: // Armor of the Damned
nart.constituents = new std::vector<ui32>();
*nart.constituents += 8, 14, 20, 26;
break;
case 133: // Statue of Legion
nart.constituents = new std::vector<ui32>();
*nart.constituents += 118, 119, 120, 121, 122;
break;
case 134: // Power of the Dragon Father
nart.constituents = new std::vector<ui32>();
*nart.constituents += 37, 38, 39, 40, 41, 42, 43, 44, 45;
break;
case 135: // Titan's Thunder
nart.constituents = new std::vector<ui32>();
*nart.constituents += 12, 18, 24, 30;
break;
case 136: // Admiral's Hat
nart.constituents = new std::vector<ui32>();
*nart.constituents += 71, 123;
break;
case 137: // Bow of the Sharpshooter
nart.constituents = new std::vector<ui32>();
*nart.constituents += 60, 61, 62;
break;
case 138: // Wizards' Well
nart.constituents = new std::vector<ui32>();
*nart.constituents += 73, 74, 75;
break;
case 139: // Ring of the Magi
nart.constituents = new std::vector<ui32>();
*nart.constituents += 76, 77, 78;
break;
case 140: // Cornucopia
nart.constituents = new std::vector<ui32>();
*nart.constituents += 109, 110, 111, 113;
break;
// TODO: WoG combinationals
default:
break;
}
artifacts.push_back(&nart);
}
if (VLC->modh->modules.COMMANDERS)
@ -429,6 +360,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
addBonuses();
// Populate reverse mappings of combinational artifacts.
//TODO: do that also for new artifacts read from mods
BOOST_FOREACH(CArtifact *artifact, artifacts)
{
if (artifact->constituents != NULL)
@ -553,6 +485,12 @@ CArtifact * CArtHandler::loadArtifact(const JsonNode & node)
return art;
}
void CArtifact::addConstituent (ui32 component)
{
assert (constituents);
constituents->push_back (component);
}
int CArtHandler::convertMachineID(int id, bool creToArt )
{
int dif = 142;
@ -764,6 +702,19 @@ void CArtHandler::addBonuses()
else if(artifact.second["type"].String() == "Commander")
makeItCommanderArt(ga->id);
const JsonNode *value;
value = &artifact.second["components"];
if (!value->isNull())
{
ga->constituents = new std::vector<ui32>();
BOOST_FOREACH (auto component, value->Vector())
{
VLC->modh->identifiers.requestIdentifier(std::string("artifact.") + component.String(),
boost::bind (&CArtifact::addConstituent, ga, _1)
);
}
}
VLC->modh->identifiers.registerObject ("artifact." + artifact.first, ga->id);
}
}

View File

@ -87,6 +87,7 @@ public:
void setName (std::string desc);
void setDescription (std::string desc);
void setEventText (std::string desc);
void addConstituent (ui32 component);
int getArtClassSerial() const; //0 - treasure, 1 - minor, 2 - major, 3 - relic, 4 - spell scroll, 5 - other
std::string nodeName() const OVERRIDE;