mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Refactoring
This commit is contained in:
@@ -19,37 +19,6 @@
|
||||
#include "../CGameState.h"
|
||||
#include "../CGameInfoCallback.h"
|
||||
|
||||
|
||||
///AdventureBonusingMechanics
|
||||
bool AdventureBonusingMechanics::applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const
|
||||
{
|
||||
const int schoolLevel = parameters.caster->getSpellSchoolLevel(owner);
|
||||
const int subtype = spellLevelToSubtype(schoolLevel);
|
||||
|
||||
GiveBonus gb;
|
||||
gb.id = parameters.caster->id.getNum();
|
||||
gb.bonus = Bonus(Bonus::ONE_DAY, bonusTypeID, Bonus::SPELL_EFFECT, 0, owner->id, subtype);
|
||||
env->sendAndApply(&gb);
|
||||
return true;
|
||||
}
|
||||
|
||||
int FlyMechanics::spellLevelToSubtype(const int schoolLevel) const
|
||||
{
|
||||
return schoolLevel >= 2 ? 1 : 2; //adv or expert
|
||||
}
|
||||
|
||||
int VisionsMechanics::spellLevelToSubtype(const int schoolLevel) const
|
||||
{
|
||||
//0,1 schoolLevel => 0 subtype
|
||||
//2 schoolLevel => 1 subtype
|
||||
//3 schoolLevel => 2 subtype
|
||||
int result = schoolLevel - 1;
|
||||
vstd::amin(result, 0);
|
||||
vstd::amax(result, 2);
|
||||
return result; //adv or expert
|
||||
}
|
||||
|
||||
|
||||
///SummonBoatMechanics
|
||||
bool SummonBoatMechanics::applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user