1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00
This commit is contained in:
mateuszb 2010-07-28 10:09:15 +00:00
parent f4b9af000f
commit f004cbff3f
3 changed files with 29 additions and 29 deletions

View File

@ -2812,7 +2812,7 @@ void CBattleInterface::castThisSpell(int spellID)
spellDestSelectMode = true;
//choosing possible tragets
const CGHeroInstance * castingHero = (attackingHeroInstance->tempOwner == curInt->playerID) ? attackingHeroInstance : attackingHeroInstance;
const CGHeroInstance * castingHero = (attackingHeroInstance->tempOwner == curInt->playerID) ? attackingHeroInstance : defendingHeroInstance;
const CSpell & spell = CGI->spellh->spells[spellID];
spellSelMode = 0;
if(spell.attributes.find("CREATURE_TARGET") != std::string::npos) //spell to be cast on one specific creature
@ -2833,7 +2833,7 @@ void CBattleInterface::castThisSpell(int spellID)
if(spell.attributes.find("CREATURE_TARGET_1") != std::string::npos ||
spell.attributes.find("CREATURE_TARGET_2") != std::string::npos) //spell to be cast on a specific creature but massive on expert
{
if(castingHero && castingHero->getSpellSecLevel(spellID) < 3)
if(castingHero && castingHero->getSpellSchoolLevel(&spell) < 3)
{
switch(spell.positiveness)
{

View File

@ -708,31 +708,31 @@ const CArtifact * CGHeroInstance::getArt(int pos) const
return NULL;
}
int CGHeroInstance::getSpellSecLevel(int spell) const
{
int bestslvl = 0;
if(VLC->spellh->spells[spell].air)
if(getSecSkillLevel(15) >= bestslvl)
{
bestslvl = getSecSkillLevel(15);
}
if(VLC->spellh->spells[spell].fire)
if(getSecSkillLevel(14) >= bestslvl)
{
bestslvl = getSecSkillLevel(14);
}
if(VLC->spellh->spells[spell].water)
if(getSecSkillLevel(16) >= bestslvl)
{
bestslvl = getSecSkillLevel(16);
}
if(VLC->spellh->spells[spell].earth)
if(getSecSkillLevel(17) >= bestslvl)
{
bestslvl = getSecSkillLevel(17);
}
return bestslvl;
}
// int CGHeroInstance::getSpellSecLevel(int spell) const
// {
// int bestslvl = 0;
// if(VLC->spellh->spells[spell].air)
// if(getSecSkillLevel(15) >= bestslvl)
// {
// bestslvl = getSecSkillLevel(15);
// }
// if(VLC->spellh->spells[spell].fire)
// if(getSecSkillLevel(14) >= bestslvl)
// {
// bestslvl = getSecSkillLevel(14);
// }
// if(VLC->spellh->spells[spell].water)
// if(getSecSkillLevel(16) >= bestslvl)
// {
// bestslvl = getSecSkillLevel(16);
// }
// if(VLC->spellh->spells[spell].earth)
// if(getSecSkillLevel(17) >= bestslvl)
// {
// bestslvl = getSecSkillLevel(17);
// }
// return bestslvl;
// }
CGHeroInstance::CGHeroInstance()
: IBoatGenerator(this)
@ -1248,7 +1248,7 @@ ui8 CGHeroInstance::getSpellSchoolLevel(const CSpell * spell, int *outSelectedSc
TRY_SCHOOL(air, 1, 0)
TRY_SCHOOL(water, 2, 2)
TRY_SCHOOL(earth, 3, 3)
#undef TRY_SCHOOL;
#undef TRY_SCHOOL

View File

@ -362,7 +362,7 @@ public:
si32 getArtPos(int aid) const; //looks for equipped artifact with given ID and returns its slot ID or -1 if none(if more than one such artifact lower ID is returned)
bool hasArt(ui32 aid) const; //checks if hero possess artifact of given id (either in backack or worn)
int getSpellSecLevel(int spell) const; //returns level of secondary ability (fire, water, earth, air magic) known to this hero and applicable to given spell; -1 if error
//int getSpellSecLevel(int spell) const; //returns level of secondary ability (fire, water, earth, air magic) known to this hero and applicable to given spell; -1 if error
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
double getHeroStrength() const;
int getTotalStrength() const;