mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
vcmiscrolls
This commit is contained in:
parent
30fa2846aa
commit
7466d7452d
@ -184,7 +184,8 @@ public:
|
||||
|
||||
void removeAfterVisit(const CGObjectInstance * object) override {};
|
||||
bool swapGarrisonOnSiege(ObjectInstanceID tid) override {return false;};
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, ArtifactPosition pos) override {return false;}
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos) override {return false;};
|
||||
bool giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos) override {return false;};
|
||||
bool putArtifact(const ArtifactLocation & al, const CArtifactInstance * art, std::optional<bool> askAssemble) override {return false;};
|
||||
void removeArtifact(const ArtifactLocation & al) override {};
|
||||
bool moveArtifact(const PlayerColor & player, const ArtifactLocation & al1, const ArtifactLocation & al2) override {return false;};
|
||||
|
@ -118,7 +118,8 @@ public:
|
||||
|
||||
virtual void removeAfterVisit(const CGObjectInstance *object) = 0; //object will be destroyed when interaction is over. Do not call when interaction is not ongoing!
|
||||
|
||||
virtual bool giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, ArtifactPosition pos) = 0;
|
||||
virtual bool giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos) = 0;
|
||||
virtual bool giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos) = 0;
|
||||
virtual bool putArtifact(const ArtifactLocation & al, const CArtifactInstance * art, std::optional<bool> askAssemble = std::nullopt) = 0;
|
||||
virtual void removeArtifact(const ArtifactLocation& al) = 0;
|
||||
virtual bool moveArtifact(const PlayerColor & player, const ArtifactLocation & al1, const ArtifactLocation & al2) = 0;
|
||||
|
@ -407,8 +407,10 @@ CGHeroInstance * CampaignState::crossoverDeserialize(const JsonNode & node, CMap
|
||||
hero->ID = Obj::HERO;
|
||||
hero->serializeJsonOptions(handler);
|
||||
if (map)
|
||||
{
|
||||
hero->serializeJsonArtifacts(handler, "artifacts");
|
||||
map->addNewArtifactInstance(*hero);
|
||||
map->addNewArtifactInstance(*hero);
|
||||
}
|
||||
return hero;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
||||
iw.components.emplace_back(ComponentType::ARTIFACT, elem);
|
||||
loot.appendRawString("%s");
|
||||
loot.replaceName(elem);
|
||||
cb->giveHeroNewArtifact(hero, elem.toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
cb->giveHeroNewArtifact(hero, elem, ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
//display loot
|
||||
if (!iw.components.empty())
|
||||
|
@ -605,7 +605,7 @@ void CGCreature::giveReward(const CGHeroInstance * h) const
|
||||
|
||||
if(gainedArtifact != ArtifactID::NONE)
|
||||
{
|
||||
cb->giveHeroNewArtifact(h, gainedArtifact.toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
cb->giveHeroNewArtifact(h, gainedArtifact, ArtifactPosition::FIRST_AVAILABLE);
|
||||
iw.components.emplace_back(ComponentType::ARTIFACT, gainedArtifact);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
|
||||
for(const auto & ci : parts)
|
||||
{
|
||||
if(ci.art->getTypeId() != elem)
|
||||
cb->giveHeroNewArtifact(h, ci.art->artType, ArtifactPosition::BACKPACK_START);
|
||||
cb->giveHeroNewArtifact(h, ci.art->getTypeId(), ArtifactPosition::BACKPACK_START);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -954,15 +954,15 @@ bool CMapLoaderH3M::loadArtifactToSlot(CGHeroInstance * hero, int slot)
|
||||
// H3 bug workaround - Enemy hero on 3rd scenario of Good1.h3c campaign ("Long Live The Queen")
|
||||
// He has Shackles of War (normally - MISC slot artifact) in LEFT_HAND slot set in editor
|
||||
// Artifact seems to be missing in game, so skip artifacts that don't fit target slot
|
||||
auto * artifact = ArtifactUtils::createArtifact(artifactID);
|
||||
if(artifact->canBePutAt(hero, ArtifactPosition(slot)))
|
||||
if(ArtifactID(artifactID).toArtifact()->canBePutAt(hero, ArtifactPosition(slot)))
|
||||
{
|
||||
auto * artifact = ArtifactUtils::createArtifact(artifactID);
|
||||
artifact->putAt(*hero, ArtifactPosition(slot));
|
||||
map->addNewArtifactInstance(artifact);
|
||||
}
|
||||
else
|
||||
{
|
||||
logGlobal->warn("Map '%s': Artifact '%s' can't be put at the slot %d", mapName, artifact->artType->getNameTranslated(), slot);
|
||||
logGlobal->warn("Map '%s': Artifact '%s' can't be put at the slot %d", mapName, ArtifactID(artifactID).toArtifact()->getNameTranslated(), slot);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1472,9 +1472,9 @@ void NewObject::applyGs(CGameState *gs)
|
||||
|
||||
void NewArtifact::applyGs(CGameState *gs)
|
||||
{
|
||||
auto art = ArtifactUtils::createArtifact(id);
|
||||
auto art = ArtifactUtils::createArtifact(artId, spellId);
|
||||
gs->map->addNewArtifactInstance(art);
|
||||
PutArtifact pa(ArtifactLocation(artHolder, pos));
|
||||
PutArtifact pa(ArtifactLocation(artHolder, pos), false);
|
||||
pa.art = art;
|
||||
pa.applyGs(gs);
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ struct DLL_LINKAGE CArtifactOperationPack : CPackForClient
|
||||
struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
|
||||
{
|
||||
PutArtifact() = default;
|
||||
explicit PutArtifact(ArtifactLocation & dst, bool askAssemble = true)
|
||||
explicit PutArtifact(const ArtifactLocation & dst, bool askAssemble = true)
|
||||
: al(dst), askAssemble(askAssemble)
|
||||
{
|
||||
}
|
||||
@ -988,7 +988,8 @@ struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
|
||||
struct DLL_LINKAGE NewArtifact : public CArtifactOperationPack
|
||||
{
|
||||
ObjectInstanceID artHolder;
|
||||
ArtifactID id;
|
||||
ArtifactID artId;
|
||||
SpellID spellId;
|
||||
ArtifactPosition pos;
|
||||
|
||||
void applyGs(CGameState * gs) override;
|
||||
@ -997,7 +998,8 @@ struct DLL_LINKAGE NewArtifact : public CArtifactOperationPack
|
||||
template <typename Handler> void serialize(Handler & h)
|
||||
{
|
||||
h & artHolder;
|
||||
h & id;
|
||||
h & artId;
|
||||
h & spellId;
|
||||
h & pos;
|
||||
}
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ void Rewardable::Interface::grantRewardAfterLevelup(IGameCallback * cb, const Re
|
||||
}
|
||||
|
||||
for(const ArtifactID & art : info.reward.artifacts)
|
||||
cb->giveHeroNewArtifact(hero, art.toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
cb->giveHeroNewArtifact(hero, art, ArtifactPosition::FIRST_AVAILABLE);
|
||||
|
||||
if(!info.reward.spells.empty())
|
||||
{
|
||||
|
@ -2267,7 +2267,7 @@ bool CGameHandler::recruitCreatures(ObjectInstanceID objid, ObjectInstanceID dst
|
||||
COMPLAIN_RET_FALSE_IF(artId == ArtifactID::CATAPULT, "Catapult cannot be recruited!");
|
||||
COMPLAIN_RET_FALSE_IF(nullptr == art, "Invalid war machine artifact");
|
||||
|
||||
return giveHeroNewArtifact(hero, art);
|
||||
return giveHeroNewArtifact(hero, artId, ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2502,7 +2502,7 @@ bool CGameHandler::moveArtifact(const PlayerColor & player, const ArtifactLocati
|
||||
|
||||
auto hero = getHero(dst.artHolder);
|
||||
if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->getId(), dstSlot))
|
||||
giveHeroNewArtifact(hero, ArtifactID(ArtifactID::SPELLBOOK).toArtifact(), ArtifactPosition::SPELLBOOK);
|
||||
giveHeroNewArtifact(hero, ArtifactID::SPELLBOOK, ArtifactPosition::SPELLBOOK);
|
||||
|
||||
ma.artsPack0.push_back(BulkMoveArtifacts::LinkedSlots(src.slot, dstSlot));
|
||||
if(src.artHolder != dst.artHolder)
|
||||
@ -2543,7 +2543,7 @@ bool CGameHandler::bulkMoveArtifacts(const PlayerColor & player, ObjectInstanceI
|
||||
if(auto dstHero = getHero(dstId))
|
||||
{
|
||||
if(ArtifactUtils::checkSpellbookIsNeeded(dstHero, artifact->getTypeId(), dstSlot))
|
||||
giveHeroNewArtifact(dstHero, ArtifactID(ArtifactID::SPELLBOOK).toArtifact(), ArtifactPosition::SPELLBOOK);
|
||||
giveHeroNewArtifact(dstHero, ArtifactID::SPELLBOOK, ArtifactPosition::SPELLBOOK);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2736,7 +2736,7 @@ bool CGameHandler::assembleArtifacts(ObjectInstanceID heroID, ArtifactPosition a
|
||||
}
|
||||
|
||||
if(ArtifactUtils::checkSpellbookIsNeeded(hero, assembleTo, artifactSlot))
|
||||
giveHeroNewArtifact(hero, ArtifactID(ArtifactID::SPELLBOOK).toArtifact(), ArtifactPosition::SPELLBOOK);
|
||||
giveHeroNewArtifact(hero, ArtifactID::SPELLBOOK, ArtifactPosition::SPELLBOOK);
|
||||
|
||||
AssembledArtifact aa;
|
||||
aa.al = dstLoc;
|
||||
@ -2793,7 +2793,7 @@ bool CGameHandler::buyArtifact(ObjectInstanceID hid, ArtifactID aid)
|
||||
return false;
|
||||
|
||||
giveResource(hero->getOwner(),EGameResID::GOLD,-GameConstants::SPELLBOOK_GOLD_COST);
|
||||
giveHeroNewArtifact(hero, ArtifactID(ArtifactID::SPELLBOOK).toArtifact(), ArtifactPosition::SPELLBOOK);
|
||||
giveHeroNewArtifact(hero, ArtifactID::SPELLBOOK, ArtifactPosition::SPELLBOOK);
|
||||
assert(hero->getArt(ArtifactPosition::SPELLBOOK));
|
||||
giveSpells(town,hero);
|
||||
return true;
|
||||
@ -2821,7 +2821,7 @@ bool CGameHandler::buyArtifact(ObjectInstanceID hid, ArtifactID aid)
|
||||
}
|
||||
|
||||
giveResource(hero->getOwner(),EGameResID::GOLD,-price);
|
||||
return giveHeroNewArtifact(hero, art);
|
||||
return giveHeroNewArtifact(hero, aid, ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
else
|
||||
COMPLAIN_RET("This machine is unavailable here!");
|
||||
@ -2874,7 +2874,7 @@ bool CGameHandler::buyArtifact(const IMarket *m, const CGHeroInstance *h, GameRe
|
||||
COMPLAIN_RET("Cannot find selected artifact on the list");
|
||||
|
||||
sendAndApply(&saa);
|
||||
giveHeroNewArtifact(h, aid.toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
giveHeroNewArtifact(h, aid, ArtifactPosition::FIRST_AVAILABLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3416,7 +3416,7 @@ bool CGameHandler::dig(const CGHeroInstance *h)
|
||||
iw.text.appendLocalString(EMetaText::GENERAL_TXT, 58); //"Congratulations! After spending many hours digging here, your hero has uncovered the " ...
|
||||
iw.text.appendName(grail); // ... " The Grail"
|
||||
iw.soundID = soundBase::ULTIMATEARTIFACT;
|
||||
giveHeroNewArtifact(h, grail.toArtifact(), ArtifactPosition::FIRST_AVAILABLE); //give grail
|
||||
giveHeroNewArtifact(h, grail, ArtifactPosition::FIRST_AVAILABLE); //give grail
|
||||
sendAndApply(&iw);
|
||||
|
||||
iw.soundID = soundBase::invalid;
|
||||
@ -3756,13 +3756,15 @@ bool CGameHandler::putArtifact(const ArtifactLocation & al, const CArtifactInsta
|
||||
}
|
||||
}
|
||||
|
||||
bool CGameHandler::giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, ArtifactPosition pos)
|
||||
bool CGameHandler::giveHeroNewArtifact(
|
||||
const CGHeroInstance * h, const CArtifact * artType, const SpellID & spellId, const ArtifactPosition & pos)
|
||||
{
|
||||
assert(artType);
|
||||
|
||||
NewArtifact na;
|
||||
na.artHolder = h->id;
|
||||
na.id = artType->getId();
|
||||
na.artId = artType->getId();
|
||||
na.spellId = spellId;
|
||||
na.pos = pos;
|
||||
|
||||
if(pos == ArtifactPosition::FIRST_AVAILABLE)
|
||||
@ -3784,6 +3786,16 @@ bool CGameHandler::giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGameHandler::giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos)
|
||||
{
|
||||
return giveHeroNewArtifact(h, artId.toArtifact(), SpellID::NONE, pos);
|
||||
}
|
||||
|
||||
bool CGameHandler::giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos)
|
||||
{
|
||||
return giveHeroNewArtifact(h, ArtifactID(ArtifactID::SPELL_SCROLL).toArtifact(), spellId, pos);
|
||||
}
|
||||
|
||||
void CGameHandler::spawnWanderingMonsters(CreatureID creatureID)
|
||||
{
|
||||
std::vector<int3>::iterator tile;
|
||||
|
@ -133,7 +133,9 @@ public:
|
||||
|
||||
void removeAfterVisit(const CGObjectInstance *object) override;
|
||||
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, ArtifactPosition pos = ArtifactPosition::FIRST_AVAILABLE) override;
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, const SpellID & spellId, const ArtifactPosition & pos);
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos) override;
|
||||
bool giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos) override;
|
||||
bool putArtifact(const ArtifactLocation & al, const CArtifactInstance * art, std::optional<bool> askAssemble) override;
|
||||
void removeArtifact(const ArtifactLocation &al) override;
|
||||
void removeArtifact(const ObjectInstanceID & srcId, const std::vector<ArtifactPosition> & slotsPack);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "../../lib/networkPacks/PacksForClient.h"
|
||||
#include "../../lib/networkPacks/StackLocation.h"
|
||||
#include "../../lib/serializer/Connection.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
|
||||
PlayerMessageProcessor::PlayerMessageProcessor(CGameHandler * gameHandler)
|
||||
@ -343,7 +344,7 @@ void PlayerMessageProcessor::cheatGiveSpells(PlayerColor player, const CGHeroIns
|
||||
|
||||
///Give hero spellbook
|
||||
if (!hero->hasSpellbook())
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(ArtifactID::SPELLBOOK).toArtifact(), ArtifactPosition::SPELLBOOK);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID::SPELLBOOK, ArtifactPosition::SPELLBOOK);
|
||||
|
||||
///Give all spells with bonus (to allow banned spells)
|
||||
GiveBonus giveBonus(GiveBonus::ETarget::OBJECT);
|
||||
@ -421,11 +422,11 @@ void PlayerMessageProcessor::cheatGiveMachines(PlayerColor player, const CGHeroI
|
||||
return;
|
||||
|
||||
if (!hero->getArt(ArtifactPosition::MACH1))
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(ArtifactID::BALLISTA).toArtifact(), ArtifactPosition::MACH1);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID::BALLISTA, ArtifactPosition::MACH1);
|
||||
if (!hero->getArt(ArtifactPosition::MACH2))
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(ArtifactID::AMMO_CART).toArtifact(), ArtifactPosition::MACH2);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID::AMMO_CART, ArtifactPosition::MACH2);
|
||||
if (!hero->getArt(ArtifactPosition::MACH3))
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(ArtifactID::FIRST_AID_TENT).toArtifact(), ArtifactPosition::MACH3);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID::FIRST_AID_TENT, ArtifactPosition::MACH3);
|
||||
}
|
||||
|
||||
void PlayerMessageProcessor::cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words)
|
||||
@ -439,7 +440,7 @@ void PlayerMessageProcessor::cheatGiveArtifacts(PlayerColor player, const CGHero
|
||||
{
|
||||
auto artID = VLC->identifiers()->getIdentifier(ModScope::scopeGame(), "artifact", word, false);
|
||||
if(artID && VLC->arth->objects[*artID])
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(*artID).toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(*artID), ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -447,11 +448,23 @@ void PlayerMessageProcessor::cheatGiveArtifacts(PlayerColor player, const CGHero
|
||||
for(int g = 7; g < VLC->arth->objects.size(); ++g) //including artifacts from mods
|
||||
{
|
||||
if(VLC->arth->objects[g]->canBePutAt(hero))
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(g).toArtifact(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
gameHandler->giveHeroNewArtifact(hero, ArtifactID(g), ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerMessageProcessor::cheatGiveScrolls(PlayerColor player, const CGHeroInstance * hero)
|
||||
{
|
||||
if(!hero)
|
||||
return;
|
||||
|
||||
for(const auto & spell : VLC->spellh->objects)
|
||||
if(gameHandler->gameState()->isAllowed(spell->getId()) && !spell->isSpecial())
|
||||
{
|
||||
gameHandler->giveHeroNewScroll(hero, spell->getId(), ArtifactPosition::FIRST_AVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerMessageProcessor::cheatLevelup(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words)
|
||||
{
|
||||
if (!hero)
|
||||
@ -675,7 +688,8 @@ bool PlayerMessageProcessor::handleCheatCode(const std::string & cheat, PlayerCo
|
||||
"vcmiolorin", "vcmiexp",
|
||||
"vcmiluck", "nwcfollowthewhiterabbit",
|
||||
"vcmimorale", "nwcmorpheus",
|
||||
"vcmigod", "nwctheone"
|
||||
"vcmigod", "nwctheone",
|
||||
"vcmiscrolls"
|
||||
};
|
||||
|
||||
if (!vstd::contains(townTargetedCheats, cheatName) && !vstd::contains(playerTargetedCheats, cheatName) && !vstd::contains(heroTargetedCheats, cheatName))
|
||||
@ -752,6 +766,7 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
|
||||
const auto & doCheatRevealPuzzle = [&]() { cheatPuzzleReveal(player); };
|
||||
const auto & doCheatMaxLuck = [&]() { cheatMaxLuck(player, hero); };
|
||||
const auto & doCheatMaxMorale = [&]() { cheatMaxMorale(player, hero); };
|
||||
const auto & doCheatGiveScrolls = [&]() { cheatGiveScrolls(player, hero); };
|
||||
const auto & doCheatTheOne = [&]()
|
||||
{
|
||||
if(!hero)
|
||||
@ -820,6 +835,7 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla
|
||||
{"nwcmorpheus", doCheatMaxMorale },
|
||||
{"vcmigod", doCheatTheOne },
|
||||
{"nwctheone", doCheatTheOne },
|
||||
{"vcmiscrolls", doCheatGiveScrolls },
|
||||
};
|
||||
|
||||
assert(callbacks.count(cheatName));
|
||||
|
@ -46,6 +46,7 @@ class PlayerMessageProcessor
|
||||
void cheatGiveArmy(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
|
||||
void cheatGiveMachines(PlayerColor player, const CGHeroInstance * hero);
|
||||
void cheatGiveArtifacts(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
|
||||
void cheatGiveScrolls(PlayerColor player, const CGHeroInstance * hero);
|
||||
void cheatLevelup(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
|
||||
void cheatExperience(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
|
||||
void cheatMovement(PlayerColor player, const CGHeroInstance * hero, std::vector<std::string> words);
|
||||
|
@ -230,17 +230,11 @@ TEST_F(CGameStateTest, DISABLED_issue2765)
|
||||
ASSERT_NE(attacker->tempOwner, defender->tempOwner);
|
||||
|
||||
{
|
||||
CArtifactInstance * a = new CArtifactInstance();
|
||||
a->artType = const_cast<CArtifact *>(ArtifactID(ArtifactID::BALLISTA).toArtifact());
|
||||
|
||||
NewArtifact na;
|
||||
na.art = a;
|
||||
na.artHolder = defender->id;
|
||||
na.artId = ArtifactID::BALLISTA;
|
||||
na.pos = ArtifactPosition::MACH1;
|
||||
gameCallback->sendAndApply(&na);
|
||||
|
||||
PutArtifact pack;
|
||||
pack.al = ArtifactLocation(defender->id, ArtifactPosition::MACH1);
|
||||
pack.art = a;
|
||||
gameCallback->sendAndApply(&pack);
|
||||
}
|
||||
|
||||
startTestBattle(attacker, defender);
|
||||
@ -324,17 +318,11 @@ TEST_F(CGameStateTest, DISABLED_battleResurrection)
|
||||
attacker->mana = attacker->manaLimit();
|
||||
|
||||
{
|
||||
CArtifactInstance * a = new CArtifactInstance();
|
||||
a->artType = const_cast<CArtifact *>(ArtifactID(ArtifactID::SPELLBOOK).toArtifact());
|
||||
|
||||
NewArtifact na;
|
||||
na.art = a;
|
||||
na.artHolder = attacker->id;
|
||||
na.artId = ArtifactID::SPELLBOOK;
|
||||
na.pos = ArtifactPosition::SPELLBOOK;
|
||||
gameCallback->sendAndApply(&na);
|
||||
|
||||
PutArtifact pack;
|
||||
pack.al = ArtifactLocation(attacker->id, ArtifactPosition::SPELLBOOK);
|
||||
pack.art = a;
|
||||
gameCallback->sendAndApply(&pack);
|
||||
}
|
||||
|
||||
startTestBattle(attacker, defender);
|
||||
|
@ -70,7 +70,8 @@ public:
|
||||
|
||||
void removeAfterVisit(const CGObjectInstance *object) override {} //object will be destroyed when interaction is over. Do not call when interaction is not ongoing!
|
||||
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const CArtifact * artType, ArtifactPosition pos) override {return false;}
|
||||
bool giveHeroNewArtifact(const CGHeroInstance * h, const ArtifactID & artId, const ArtifactPosition & pos) override {return false;}
|
||||
bool giveHeroNewScroll(const CGHeroInstance * h, const SpellID & spellId, const ArtifactPosition & pos) override {return false;}
|
||||
bool putArtifact(const ArtifactLocation & al, const CArtifactInstance * art, std::optional<bool> askAssemble) override {return false;}
|
||||
void removeArtifact(const ArtifactLocation &al) override {}
|
||||
bool moveArtifact(const PlayerColor & player, const ArtifactLocation & al1, const ArtifactLocation & al2) override {return false;}
|
||||
|
Loading…
Reference in New Issue
Block a user