mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Some (disabled) work for commander artifacts. Hero artifacts window seems broken.
Minor fixes.
This commit is contained in:
parent
665837d656
commit
6419f953cb
@ -340,7 +340,7 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
|
||||
}
|
||||
file += sufix += ".bmp";
|
||||
|
||||
auto skillGraphics = new CPicture(file, 38 + i * 84, 223);
|
||||
auto skillGraphics = new CPicture(file, 37 + i * 84, 224);
|
||||
}
|
||||
}
|
||||
//print commander level
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CLodHandler.h"
|
||||
#include "../lib/CObjectHandler.h"
|
||||
#include "../lib/NetPacks.h"
|
||||
|
||||
#include "UIFramework/CGuiHandler.h"
|
||||
#include "UIFramework/CIntObjectClasses.h"
|
||||
@ -297,7 +298,28 @@ void CHeroWindow::questlog()
|
||||
|
||||
void CHeroWindow::commanderWindow()
|
||||
{
|
||||
GH.pushInt(new CCreatureWindow (curHero->commander));
|
||||
//TODO: allow equipping commander artifacts by drag / drop
|
||||
//bool artSelected = false;
|
||||
//const CArtifactsOfHero::SCommonPart *commonInfo = artSets.front()->commonInfo;
|
||||
|
||||
//if (const CArtifactInstance *art = commonInfo->src.art)
|
||||
//{
|
||||
// const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
|
||||
// artSelected = true;
|
||||
// ArtifactLocation src (srcHero, commonInfo->src.slotID);
|
||||
// ArtifactLocation dst (curHero->commander.get(), commonInfo->src.slotID);
|
||||
// if (art->canBePutAt(dst, true))
|
||||
// { //equip clicked stack
|
||||
// if(dst.getArt())
|
||||
// {
|
||||
// LOCPLINT->cb->swapArtifacts (dst, ArtifactLocation(srcHero, dst.getArt()->firstBackpackSlot(srcHero)));
|
||||
// }
|
||||
// LOCPLINT->cb->swapArtifacts(src, dst);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
GH.pushInt(new CCreatureWindow (curHero->commander));
|
||||
|
||||
}
|
||||
|
||||
void CHeroWindow::showAll(SDL_Surface * to)
|
||||
|
@ -5052,7 +5052,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact
|
||||
{
|
||||
assert(commonInfo->dst == dst //expected movement from slot ot slot
|
||||
|| dst.slot == dst.getHolderArtSet()->artifactsInBackpack.size() + GameConstants::BACKPACK_START //artifact moved back to backpack (eg. to make place for art we are moving)
|
||||
|| dst.getHolderArtSet()->bearerType() == ArtBearer::CREATURE);
|
||||
|| dst.getHolderArtSet()->bearerType() != ArtBearer::HERO);
|
||||
commonInfo->reset();
|
||||
unmarkSlots();
|
||||
}
|
||||
|
@ -238,6 +238,7 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
||||
nart.price=atoi(pom.c_str());
|
||||
nart.possibleSlots[ArtBearer::HERO]; //we want to generate map entry even if it will be empty
|
||||
nart.possibleSlots[ArtBearer::CREATURE]; //we want to generate map entry even if it will be empty
|
||||
//nart.possibleSlots[ArtBearer::COMMANDER];
|
||||
for(int j=0;j<slots.size();j++)
|
||||
{
|
||||
loadToIt(pom,buf,it,4);
|
||||
@ -511,10 +512,23 @@ void CArtHandler::makeItCreatureArt (int aid, bool onlyCreature /*=true*/)
|
||||
if (onlyCreature)
|
||||
{
|
||||
a->possibleSlots[ArtBearer::HERO].clear();
|
||||
//a->possibleSlots[ArtBearer::COMMANDER].clear();
|
||||
}
|
||||
a->possibleSlots[ArtBearer::CREATURE].push_back(ArtifactPosition::CREATURE_SLOT);
|
||||
};
|
||||
|
||||
void CArtHandler::makeItCommanderArt (int aid, bool onlyCommander /*=true*/)
|
||||
{
|
||||
//CArtifact *a = artifacts[aid];
|
||||
//if (onlyCommander)
|
||||
//{
|
||||
// a->possibleSlots[ArtBearer::HERO].clear();
|
||||
// a->possibleSlots[ArtBearer::CREATURE].clear();
|
||||
//}
|
||||
//for (int i = ArtifactPosition::COMMANDER1; i <= ArtifactPosition::COMMANDER6; ++i)
|
||||
// a->possibleSlots[ArtBearer::COMMANDER].push_back(i);
|
||||
};
|
||||
|
||||
void CArtHandler::addBonuses()
|
||||
{
|
||||
#define ART_PRIM_SKILL(ID, whichSkill, val) giveArtBonus(ID,Bonus::PRIMARY_SKILL,val,whichSkill)
|
||||
@ -801,6 +815,13 @@ void CArtHandler::addBonuses()
|
||||
artifacts[156].get()->setDescription ("+2 stack HP");
|
||||
|
||||
}
|
||||
if (GameConstants::COMMANDERS)
|
||||
{
|
||||
for (int i = 146; i <= 155; ++i)
|
||||
{
|
||||
makeItCommanderArt (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CArtHandler::clear()
|
||||
@ -920,6 +941,13 @@ void CArtHandler::initAllowedArtifactsList(const std::vector<ui8> &allowed)
|
||||
if (allowed[i])
|
||||
allowedArtifacts.push_back(artifacts[i]);
|
||||
}
|
||||
//if (GameConstants::COMMANDERS) //allow all commander artifacts for testing
|
||||
//{
|
||||
// for (int i = 146; i <= 155; ++i)
|
||||
// {
|
||||
// allowedArtifacts.push_back(artifacts[i]);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
CArtifactInstance::CArtifactInstance()
|
||||
|
@ -28,7 +28,8 @@ namespace ArtifactPosition
|
||||
MACH1, MACH2, MACH3, MACH4, SPELLBOOK, MISC5,
|
||||
AFTER_LAST,
|
||||
//cres
|
||||
CREATURE_SLOT = 0
|
||||
CREATURE_SLOT = 0/*,
|
||||
COMMANDER1 = 0, COMMANDER2, COMMANDER3, COMMANDER4, COMMANDER5, COMMANDER6*/
|
||||
};
|
||||
}
|
||||
|
||||
@ -243,6 +244,7 @@ public:
|
||||
void initAllowedArtifactsList(const std::vector<ui8> &allowed); //allowed[art_id] -> 0 if not allowed, 1 if allowed
|
||||
static int convertMachineID(int id, bool creToArt);
|
||||
void makeItCreatureArt (int aid, bool onlyCreature = true);
|
||||
void makeItCommanderArt (int aid, bool onlyCommander = true);
|
||||
CArtHandler();
|
||||
~CArtHandler();
|
||||
|
||||
|
@ -757,6 +757,7 @@ std::string CStackInstance::bonusToGraphics(Bonus *bonus) const
|
||||
fileName = "E_REBIRTH.bmp"; break;
|
||||
case Bonus::BLOCKS_RETALIATION:
|
||||
fileName = "E_RETAIL.bmp"; break;
|
||||
case Bonus::UNLIMITED_RETALIATIONS:
|
||||
case Bonus::ADDITIONAL_RETALIATION:
|
||||
fileName = "E_RETAIL1.bmp"; break;
|
||||
case Bonus::ATTACKS_ALL_ADJACENT:
|
||||
@ -1025,6 +1026,11 @@ void CCommanderInstance::levelUp ()
|
||||
}
|
||||
}
|
||||
|
||||
ui8 CCommanderInstance::bearerType() const
|
||||
{
|
||||
return ArtBearer::COMMANDER;
|
||||
}
|
||||
|
||||
CStackBasicDescriptor::CStackBasicDescriptor()
|
||||
{
|
||||
type = NULL;
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
ui64 getPower() const {return 0;};
|
||||
int getExpRank() const;
|
||||
ui8 bearerType() const OVERRIDE {return ArtBearer::COMMANDER;}; //from CArtifactSet
|
||||
ui8 bearerType() const OVERRIDE; //from CArtifactSet
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
@ -298,6 +298,7 @@ void CGameHandler::levelUpCommander (const CCommanderInstance * c, int skill)
|
||||
return;
|
||||
}
|
||||
|
||||
scp.accumulatedBonus.subtype = 0;
|
||||
scp.accumulatedBonus.additionalInfo = 0;
|
||||
scp.accumulatedBonus.duration = Bonus::PERMANENT;
|
||||
scp.accumulatedBonus.turnsRemain = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user