mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Removed remaining hardcoded objects
This commit is contained in:
parent
62e127fb59
commit
f8f6df02f3
@ -314,8 +314,9 @@ bool isWeeklyRevisitable(const CGObjectInstance * obj)
|
||||
return false;
|
||||
|
||||
//TODO: allow polling of remaining creatures in dwelling
|
||||
if(dynamic_cast<const CGVisitableOPW *>(obj)) // ensures future compatibility, unlike IDs
|
||||
return true;
|
||||
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj))
|
||||
return rewardable->getResetDuration() == 7;
|
||||
|
||||
if(dynamic_cast<const CGDwelling *>(obj))
|
||||
return true;
|
||||
if(dynamic_cast<const CBank *>(obj)) //banks tend to respawn often in mods
|
||||
|
@ -79,9 +79,6 @@ void AIMemory::markObjectVisited(const CGObjectInstance * obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if(dynamic_cast<const CGVisitableOPH *>(obj)) //we may want to visit it with another hero
|
||||
return;
|
||||
|
||||
if(obj->ID == Obj::MONSTER)
|
||||
return;
|
||||
|
||||
|
@ -29,12 +29,6 @@
|
||||
|
||||
extern FuzzyHelper * fh;
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class CGVisitableOPW;
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
const double SAFE_ATTACK_CONSTANT = 1.5;
|
||||
|
||||
//one thread may be turn of AI and another will be handling a side effect for AI2
|
||||
@ -1616,9 +1610,6 @@ void VCAI::markObjectVisited(const CGObjectInstance * obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if(dynamic_cast<const CGVisitableOPH *>(obj)) //we may want to visit it with another hero
|
||||
return;
|
||||
|
||||
if(obj->ID == Obj::MONSTER)
|
||||
return;
|
||||
|
||||
@ -2752,8 +2743,9 @@ bool AIStatus::channelProbing()
|
||||
bool isWeeklyRevisitable(const CGObjectInstance * obj)
|
||||
{
|
||||
//TODO: allow polling of remaining creatures in dwelling
|
||||
if(dynamic_cast<const CGVisitableOPW *>(obj)) // ensures future compatibility, unlike IDs
|
||||
return true;
|
||||
if(const auto * rewardable = dynamic_cast<const CRewardableObject *>(obj))
|
||||
return rewardable->getResetDuration() == 7;
|
||||
|
||||
if(dynamic_cast<const CGDwelling *>(obj))
|
||||
return true;
|
||||
if(dynamic_cast<const CBank *>(obj)) //banks tend to respawn often in mods
|
||||
|
@ -51,7 +51,7 @@
|
||||
"config/objects/moddables.json",
|
||||
"config/objects/creatureBanks.json",
|
||||
"config/objects/dwellings.json",
|
||||
"config/objects/rewardable.json",
|
||||
"config/objects/rewardableOncePerWeek.json",
|
||||
"config/objects/rewardablePickable.json",
|
||||
"config/objects/rewardableOnceVisitable.json",
|
||||
"config/objects/rewardableOncePerHero.json",
|
||||
|
@ -597,28 +597,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"magicWell" : {
|
||||
"index" :49,
|
||||
"handler" : "magicWell",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"visit" : ["FAERIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"object" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 250,
|
||||
"rmg" : {
|
||||
"zoneLimit" : 1,
|
||||
"value" : 250,
|
||||
"rarity" : 100
|
||||
}
|
||||
},
|
||||
"objectWoG" : { "index" : 1} // WoG object? Present on VCMI_Test 2011b
|
||||
}
|
||||
},
|
||||
|
||||
/// Random objects
|
||||
"randomTown" : { "index" :77, "handler": "randomTown", "types" : { "object" : { "index" : 0} } },
|
||||
"randomHero" : {
|
||||
|
@ -1,87 +0,0 @@
|
||||
{
|
||||
/// These are objects that covered by concept of "configurable object"
|
||||
/// Most or even all of their configuration located in this file
|
||||
"magicSpring" : {//magic source
|
||||
"index" : 48,
|
||||
"handler": "magicSpring",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPFOUN"],
|
||||
"visit" : ["FAERIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"object" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 500//,
|
||||
//"rmg" : {
|
||||
// "zoneLimit" : 1,
|
||||
// "value" : 500,
|
||||
// "rarity" : 50
|
||||
//}
|
||||
//banned due to problems with 2 viistable offsets
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"mysticalGarden" : {
|
||||
"index" : 55,
|
||||
"handler": "oncePerWeek",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPLEPR"],
|
||||
"visit" : ["EXPERNCE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"object" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 500,
|
||||
"rmg" : {
|
||||
"value" : 500,
|
||||
"rarity" : 50
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"windmill" :{
|
||||
"index" : 112,
|
||||
"handler": "oncePerWeek",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPWIND"],
|
||||
"visit" : ["GENIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"object" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 1500,
|
||||
"rmg" : {
|
||||
"value" : 1500,
|
||||
"rarity" : 80
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"waterWheel" : {
|
||||
"index" : 109,
|
||||
"handler": "oncePerWeek",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPMILL"],
|
||||
"visit" : ["GENIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"object" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 750,
|
||||
"rmg" : {
|
||||
"value" : 750,
|
||||
"rarity" : 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
|
||||
"onVisitedMessage" : 40,
|
||||
"visitMode" : "hero",
|
||||
"selectMode" : "selectPlayer",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 39,
|
||||
@ -84,7 +84,7 @@
|
||||
|
||||
"onVisitedMessage" : 60,
|
||||
"visitMode" : "hero",
|
||||
"selectMode" : "selectPlayer",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 59,
|
||||
@ -191,7 +191,7 @@
|
||||
|
||||
"onVisitedMessage" : 81,
|
||||
"visitMode" : "hero",
|
||||
"selectMode" : "selectPlayer",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 80,
|
||||
@ -221,7 +221,7 @@
|
||||
|
||||
"onVisitedMessage" : 101,
|
||||
"visitMode" : "hero",
|
||||
"selectMode" : "selectPlayer",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 100,
|
||||
@ -233,7 +233,7 @@
|
||||
},
|
||||
"treeOfKnowledge" : {
|
||||
"index" : 102,
|
||||
"handler": "oncePerHero", //TODO: configurable
|
||||
"handler": "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"visit" : ["GAZEBO"]
|
||||
@ -247,7 +247,33 @@
|
||||
"mapLimit" : 100,
|
||||
"value" : 2500,
|
||||
"rarity" : 50
|
||||
}
|
||||
},
|
||||
|
||||
"onEmptyMessage" : 150, //TODO: ID 150 should be used for Gold version, ID 152 - for Gems version
|
||||
"visitMode" : "hero",
|
||||
"selectMode" : "selectFirst",
|
||||
"canRefuse" : true,
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 148,
|
||||
"appearChance" : { "max" : 34 },
|
||||
"gainedLevels" : 1
|
||||
},
|
||||
{
|
||||
"message" : 149,
|
||||
"appearChance" : { "min" : 34, "max" : 67 },
|
||||
"limiter" : { "resources" : { "gold" : 2000 } },
|
||||
"resources" : { "gold" : -2000 },
|
||||
"gainedLevels" : 1
|
||||
},
|
||||
{
|
||||
"message" : 151,
|
||||
"appearChance" : { "min" : 67 },
|
||||
"limiter" : { "resources" : { "gems" : 10 } },
|
||||
"resources" : { "gems" : -10 },
|
||||
"gainedLevels" : 1
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
176
config/objects/rewardableOncePerWeek.json
Normal file
176
config/objects/rewardableOncePerWeek.json
Normal file
@ -0,0 +1,176 @@
|
||||
{
|
||||
/// These are objects that covered by concept of "configurable object" and have their entire configuration in this config
|
||||
|
||||
"magicWell" : {
|
||||
"index" :49,
|
||||
"handler" : "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"visit" : ["FAERIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"magicWell" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 250,
|
||||
"rmg" : {
|
||||
"zoneLimit" : 1,
|
||||
"value" : 250,
|
||||
"rarity" : 100
|
||||
},
|
||||
|
||||
"onEmptyMessage" : 79,
|
||||
"onVisitedMessage" : 78,
|
||||
"resetDuration" : 1,
|
||||
"visitMode" : "once",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
// TODO: limiter "below mana maximum"
|
||||
"message" : 77,
|
||||
"manaPercentage" : 100
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
"magicSpring" : {
|
||||
"index" : 48,
|
||||
"handler": "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPFOUN"],
|
||||
"visit" : ["FAERIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"magicSpring" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 500,
|
||||
//banned due to problems with 2 viistable offsets
|
||||
//"rmg" : {
|
||||
// "zoneLimit" : 1,
|
||||
// "value" : 500,
|
||||
// "rarity" : 50
|
||||
//},
|
||||
|
||||
"onEmptyMessage" : 75,
|
||||
"resetDuration" : 7,
|
||||
"visitMode" : "once",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
// TODO: limiter "below mana maximum"
|
||||
"message" : 74,
|
||||
"manaPercentage" : 200
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"mysticalGarden" : {
|
||||
"index" : 55,
|
||||
"handler": "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPLEPR"],
|
||||
"visit" : ["EXPERNCE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"mysticalGarden" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 500,
|
||||
"rmg" : {
|
||||
"value" : 500,
|
||||
"rarity" : 50
|
||||
},
|
||||
|
||||
"onEmptyMessage" : 93,
|
||||
"resetDuration" : 7,
|
||||
"visitMode" : "once",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 92,
|
||||
"appearChance" : { "max" : 50 },
|
||||
"resources" : { "gems" : 5 }
|
||||
},
|
||||
{
|
||||
"message" : 92,
|
||||
"appearChance" : { "min" : 50 },
|
||||
"resources" : { "gold" : 500 }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"windmill" :{
|
||||
"index" : 112,
|
||||
"handler": "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPWIND"],
|
||||
"visit" : ["GENIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"windmill" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 1500,
|
||||
"rmg" : {
|
||||
"value" : 1500,
|
||||
"rarity" : 80
|
||||
},
|
||||
|
||||
"onEmptyMessage" : 169,
|
||||
"resetDuration" : 7,
|
||||
"visitMode" : "once",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 170,
|
||||
"resources" : [
|
||||
{
|
||||
"list" : [ "ore", "mercury", "gems", "sulfur", "crystal" ],
|
||||
"min" : 3,
|
||||
"max" : 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"waterWheel" : {
|
||||
"index" : 109,
|
||||
"handler": "configurable",
|
||||
"base" : {
|
||||
"sounds" : {
|
||||
"ambient" : ["LOOPMILL"],
|
||||
"visit" : ["GENIE"]
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"waterWheel" : {
|
||||
"index" : 0,
|
||||
"aiValue" : 750,
|
||||
"rmg" : {
|
||||
"value" : 750,
|
||||
"rarity" : 50
|
||||
},
|
||||
|
||||
"onEmptyMessage" : 165,
|
||||
"resetDuration" : 7,
|
||||
"visitMode" : "once",
|
||||
"selectMode" : "selectFirst",
|
||||
"rewards" : [
|
||||
{
|
||||
"message" : 164,
|
||||
"resources" : { "gold" : 1000 }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -64,8 +64,6 @@ CObjectClassesHandler::CObjectClassesHandler()
|
||||
SET_HANDLER("keymaster", CGKeymasterTent);
|
||||
SET_HANDLER("lighthouse", CGLighthouse);
|
||||
SET_HANDLER("magi", CGMagi);
|
||||
SET_HANDLER("magicSpring", CGMagicSpring);
|
||||
SET_HANDLER("magicWell", CGMagicWell);
|
||||
SET_HANDLER("market", CGMarket);
|
||||
SET_HANDLER("mine", CGMine);
|
||||
SET_HANDLER("obelisk", CGObelisk);
|
||||
@ -84,8 +82,6 @@ CObjectClassesHandler::CObjectClassesHandler()
|
||||
SET_HANDLER("subterraneanGate", CGSubterraneanGate);
|
||||
SET_HANDLER("whirlpool", CGWhirlpool);
|
||||
SET_HANDLER("university", CGUniversity);
|
||||
SET_HANDLER("oncePerHero", CGVisitableOPH);
|
||||
SET_HANDLER("oncePerWeek", CGVisitableOPW);
|
||||
SET_HANDLER("witch", CGWitchHut);
|
||||
SET_HANDLER("terrain", CGTerrainPatch);
|
||||
|
||||
|
@ -111,11 +111,11 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
|
||||
// grant reward afterwards. Note that it may remove object
|
||||
grantReward(index, h);
|
||||
};
|
||||
auto selectRewardsMessage = [&](std::vector<ui32> rewards) -> void
|
||||
auto selectRewardsMessage = [&](std::vector<ui32> rewards, const MetaString & dialog) -> void
|
||||
{
|
||||
BlockingDialog sd(canRefuse, rewards.size() > 1);
|
||||
sd.player = h->tempOwner;
|
||||
sd.text = onSelect;
|
||||
sd.text = dialog;
|
||||
for (auto index : rewards)
|
||||
sd.components.push_back(getVisitInfo(index, h).reward.getDisplayedComponent(h));
|
||||
cb->showBlockingDialog(&sd);
|
||||
@ -148,7 +148,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
|
||||
case 1: // one reward. Just give it with message
|
||||
{
|
||||
if (canRefuse)
|
||||
selectRewardsMessage(rewards);
|
||||
selectRewardsMessage(rewards, getVisitInfo(rewards[0], h).message);
|
||||
else
|
||||
grantRewardWithMessage(rewards[0]);
|
||||
break;
|
||||
@ -157,7 +157,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
|
||||
{
|
||||
switch (selectMode) {
|
||||
case SELECT_PLAYER: // player must select
|
||||
selectRewardsMessage(rewards);
|
||||
selectRewardsMessage(rewards, onSelect);
|
||||
break;
|
||||
case SELECT_FIRST: // give first available
|
||||
grantRewardWithMessage(rewards[0]);
|
||||
@ -269,7 +269,7 @@ void CRewardableObject::grantRewardAfterLevelup(const CVisitInfo & info, const C
|
||||
if (info.reward.manaPercentage >= 0)
|
||||
manaScaled = hero->manaLimit() * info.reward.manaPercentage / 100;
|
||||
|
||||
si32 manaMissing = hero->manaLimit() - manaScaled;
|
||||
si32 manaMissing = std::max(0, hero->manaLimit() - manaScaled);
|
||||
si32 manaGranted = std::min(manaMissing, info.reward.manaDiff);
|
||||
si32 manaOverflow = info.reward.manaDiff - manaGranted;
|
||||
si32 manaOverLimit = manaOverflow * info.reward.manaOverflowFactor / 100;
|
||||
@ -364,6 +364,11 @@ CRewardableObject::EVisitMode CRewardableObject::getVisitMode() const
|
||||
return EVisitMode(visitMode);
|
||||
}
|
||||
|
||||
ui16 CRewardableObject::getResetDuration() const
|
||||
{
|
||||
return resetDuration;
|
||||
}
|
||||
|
||||
void CRewardInfo::loadComponents(std::vector<Component> & comps,
|
||||
const CGHeroInstance * h) const
|
||||
{
|
||||
@ -473,150 +478,7 @@ CRewardableObject::CRewardableObject():
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CGVisitableOPH::CGVisitableOPH()
|
||||
{
|
||||
visitMode = VISIT_HERO;
|
||||
selectMode = SELECT_PLAYER;
|
||||
}
|
||||
|
||||
void CGVisitableOPH::initObj(CRandomGenerator & rand)
|
||||
{
|
||||
switch(ID)
|
||||
{
|
||||
case Obj::TREE_OF_KNOWLEDGE:
|
||||
info.resize(1);
|
||||
canRefuse = true;
|
||||
info[0].reward.gainedLevels = 1;
|
||||
onVisited.addTxt(MetaString::ADVOB_TXT, 147);
|
||||
info.resize(1);
|
||||
switch (rand.nextInt(2))
|
||||
{
|
||||
case 0: // free
|
||||
onSelect.addTxt(MetaString::ADVOB_TXT, 148);
|
||||
break;
|
||||
case 1:
|
||||
info[0].limiter.resources[Res::GOLD] = 2000;
|
||||
info[0].reward.resources[Res::GOLD] = -2000;
|
||||
onSelect.addTxt(MetaString::ADVOB_TXT, 149);
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 150);
|
||||
break;
|
||||
case 2:
|
||||
info[0].limiter.resources[Res::GEMS] = 10;
|
||||
info[0].reward.resources[Res::GEMS] = -10;
|
||||
onSelect.addTxt(MetaString::ADVOB_TXT, 151);
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 152);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CGVisitableOPW::CGVisitableOPW()
|
||||
{
|
||||
visitMode = VISIT_ONCE;
|
||||
resetDuration = 7;
|
||||
}
|
||||
|
||||
void CGVisitableOPW::triggerRewardReset() const
|
||||
{
|
||||
CRewardableObject::triggerRewardReset();
|
||||
|
||||
ChangeObjectVisitors cov(ChangeObjectVisitors::VISITOR_CLEAR, id);
|
||||
cb->sendAndApply(&cov);
|
||||
}
|
||||
|
||||
void CGVisitableOPW::initObj(CRandomGenerator & rand)
|
||||
{
|
||||
setRandomReward(rand);
|
||||
|
||||
switch (ID)
|
||||
{
|
||||
case Obj::MYSTICAL_GARDEN:
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 93);
|
||||
info[0].message.addTxt(MetaString::ADVOB_TXT, 92);
|
||||
break;
|
||||
case Obj::WINDMILL:
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 169);
|
||||
info[0].message.addTxt(MetaString::ADVOB_TXT, 170);
|
||||
break;
|
||||
case Obj::WATER_WHEEL:
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 165);
|
||||
info[0].message.addTxt(MetaString::ADVOB_TXT, 164);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CGVisitableOPW::setPropertyDer(ui8 what, ui32 val)
|
||||
{
|
||||
if(what == ObjProperty::REWARD_RESET)
|
||||
{
|
||||
setRandomReward(cb->gameState()->getRandomGenerator());
|
||||
|
||||
if (ID == Obj::WATER_WHEEL)
|
||||
{
|
||||
auto& reward = info[0].reward.resources[Res::GOLD];
|
||||
if(cb->getDate() > 7)
|
||||
{
|
||||
reward = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
reward = 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CRewardableObject::setPropertyDer(what, val);
|
||||
}
|
||||
|
||||
void CGVisitableOPW::setRandomReward(CRandomGenerator &rand)
|
||||
{
|
||||
switch (ID)
|
||||
{
|
||||
case Obj::MYSTICAL_GARDEN:
|
||||
info.resize(1);
|
||||
info[0].limiter.numOfGrants = 1;
|
||||
info[0].reward.resources.amin(0);
|
||||
if (rand.nextInt(1) == 0)
|
||||
{
|
||||
info[0].reward.resources[Res::GEMS] = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
info[0].reward.resources[Res::GOLD] = 500;
|
||||
}
|
||||
break;
|
||||
case Obj::WINDMILL:
|
||||
info.resize(1);
|
||||
info[0].reward.resources.amin(0);
|
||||
// 3-6 of any resource but wood and gold
|
||||
info[0].reward.resources[rand.nextInt(Res::MERCURY, Res::GEMS)] = rand.nextInt(3, 6);
|
||||
info[0].limiter.numOfGrants = 1;
|
||||
break;
|
||||
case Obj::WATER_WHEEL:
|
||||
info.resize(1);
|
||||
info[0].reward.resources.amin(0);
|
||||
info[0].reward.resources[Res::GOLD] = 500;
|
||||
info[0].limiter.numOfGrants = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CGMagicSpring::initObj(CRandomGenerator & rand)
|
||||
{
|
||||
CVisitInfo visit; // TODO: "player above max mana" limiter. Use logical expressions for limiters?
|
||||
visit.reward.manaPercentage = 200;
|
||||
visit.message.addTxt(MetaString::ADVOB_TXT, 74);
|
||||
info.push_back(visit); // two rewards, one for each entrance
|
||||
info.push_back(visit);
|
||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 75);
|
||||
}
|
||||
|
||||
/*
|
||||
std::vector<int3> CGMagicSpring::getVisitableOffsets() const
|
||||
{
|
||||
std::vector <int3> visitableTiles;
|
||||
@ -660,5 +522,5 @@ std::vector<ui32> CGMagicSpring::getAvailableRewards(const CGHeroInstance * hero
|
||||
// hero is either not on visitable tile (should not happen) or tile is already used
|
||||
return std::vector<ui32>();
|
||||
}
|
||||
|
||||
*/
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -249,6 +249,7 @@ protected:
|
||||
|
||||
public:
|
||||
EVisitMode getVisitMode() const;
|
||||
ui16 getResetDuration() const;
|
||||
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
@ -295,55 +296,6 @@ public:
|
||||
friend class CRandomRewardObjectInfo;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGVisitableOPH : public CRewardableObject //objects visitable only once per hero
|
||||
{
|
||||
public:
|
||||
void initObj(CRandomGenerator & rand) override;
|
||||
|
||||
CGVisitableOPH();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CRewardableObject&>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGVisitableOPW : public CRewardableObject //objects visitable once per week
|
||||
{
|
||||
protected:
|
||||
void triggerRewardReset() const override;
|
||||
|
||||
public:
|
||||
void initObj(CRandomGenerator & rand) override;
|
||||
|
||||
CGVisitableOPW();
|
||||
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
void setRandomReward(CRandomGenerator & rand);
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CRewardableObject&>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
///Special case - magic spring that has two separate visitable entrances
|
||||
class DLL_LINKAGE CGMagicSpring : public CGVisitableOPW
|
||||
{
|
||||
protected:
|
||||
std::vector<ui32> getAvailableRewards(const CGHeroInstance * hero) const override;
|
||||
|
||||
public:
|
||||
void initObj(CRandomGenerator & rand) override;
|
||||
std::vector<int3> getVisitableOffsets() const;
|
||||
int3 getVisitableOffset() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGVisitableOPW&>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
//TODO:
|
||||
|
||||
// MAX
|
||||
|
@ -1527,32 +1527,6 @@ void CGWitchHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
}
|
||||
}
|
||||
|
||||
void CGMagicWell::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
int message;
|
||||
|
||||
if(h->hasBonusFrom(Bonus::OBJECT,ID)) //has already visited Well today
|
||||
{
|
||||
message = 78;//"A second drink at the well in one day will not help you."
|
||||
}
|
||||
else if(h->mana < h->manaLimit())
|
||||
{
|
||||
giveDummyBonus(h->id);
|
||||
cb->setManaPoints(h->id,h->manaLimit());
|
||||
message = 77;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = 79;
|
||||
}
|
||||
showInfoDialog(h, message);
|
||||
}
|
||||
|
||||
std::string CGMagicWell::getHoverText(const CGHeroInstance * hero) const
|
||||
{
|
||||
return getObjectName() + " " + visitedTxt(hero->hasBonusFrom(Bonus::OBJECT,ID));
|
||||
}
|
||||
|
||||
void CGObservatory::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
InfoWindow iw;
|
||||
|
@ -391,18 +391,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGMagicWell : public CGObjectInstance //objects giving bonuses to luck/morale/movement
|
||||
{
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
std::string getHoverText(const CGHeroInstance * hero) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGSirens : public CGObjectInstance
|
||||
{
|
||||
public:
|
||||
|
@ -45,7 +45,6 @@ void registerTypesMapObjects1(Serializer &s)
|
||||
s.template registerType<CGMonolith, CGWhirlpool>();
|
||||
s.template registerType<CGObjectInstance, CGSignBottle>();
|
||||
s.template registerType<CGObjectInstance, CGScholar>();
|
||||
s.template registerType<CGObjectInstance, CGMagicWell>();
|
||||
s.template registerType<CGObjectInstance, CGObservatory>();
|
||||
s.template registerType<CGObjectInstance, CGKeys>();
|
||||
s.template registerType<CGKeys, CGKeymasterTent>();
|
||||
@ -112,8 +111,6 @@ void registerTypesMapObjectTypes(Serializer &s)
|
||||
REGISTER_GENERIC_HANDLER(CGLighthouse);
|
||||
REGISTER_GENERIC_HANDLER(CGTerrainPatch);
|
||||
REGISTER_GENERIC_HANDLER(CGMagi);
|
||||
REGISTER_GENERIC_HANDLER(CGMagicSpring);
|
||||
REGISTER_GENERIC_HANDLER(CGMagicWell);
|
||||
REGISTER_GENERIC_HANDLER(CGMarket);
|
||||
REGISTER_GENERIC_HANDLER(CGMine);
|
||||
REGISTER_GENERIC_HANDLER(CGObelisk);
|
||||
@ -132,8 +129,6 @@ void registerTypesMapObjectTypes(Serializer &s)
|
||||
REGISTER_GENERIC_HANDLER(CGWhirlpool);
|
||||
REGISTER_GENERIC_HANDLER(CGTownInstance);
|
||||
REGISTER_GENERIC_HANDLER(CGUniversity);
|
||||
REGISTER_GENERIC_HANDLER(CGVisitableOPH);
|
||||
REGISTER_GENERIC_HANDLER(CGVisitableOPW);
|
||||
REGISTER_GENERIC_HANDLER(CGWitchHut);
|
||||
|
||||
#undef REGISTER_GENERIC_HANDLER
|
||||
@ -159,9 +154,6 @@ void registerTypesMapObjects2(Serializer &s)
|
||||
s.template registerType<CGTownBuilding, COPWBonus>();
|
||||
|
||||
s.template registerType<CGObjectInstance, CRewardableObject>();
|
||||
s.template registerType<CRewardableObject, CGVisitableOPH>();
|
||||
s.template registerType<CRewardableObject, CGVisitableOPW>();
|
||||
s.template registerType<CGVisitableOPW, CGMagicSpring>();
|
||||
|
||||
s.template registerType<CGObjectInstance, CTeamVisited>();
|
||||
s.template registerType<CTeamVisited, CGWitchHut>();
|
||||
|
Loading…
Reference in New Issue
Block a user