1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/lib/spells/ISpellMechanics.cpp
AlexVinS 2d8288d95a Fix mantiss 0002167
* also refactored summon mechanics
2015-04-11 12:09:48 +03:00

96 lines
2.6 KiB
C++

/*
* ISpellMechanics.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "ISpellMechanics.h"
#include "CDefaultSpellMechanics.h"
#include "AdventureSpellMechanics.h"
#include "BattleSpellMechanics.h"
#include "CreatureSpellMechanics.h"
///ISpellMechanics
ISpellMechanics::ISpellMechanics(CSpell * s):
owner(s)
{
}
ISpellMechanics * ISpellMechanics::createMechanics(CSpell * s)
{
switch (s->id)
{
case SpellID::ANTI_MAGIC:
return new AntimagicMechanics(s);
case SpellID::ACID_BREATH_DAMAGE:
return new AcidBreathDamageMechanics(s);
case SpellID::CHAIN_LIGHTNING:
return new ChainLightningMechanics(s);
case SpellID::CLONE:
return new CloneMechanics(s);
case SpellID::CURE:
return new CureMechanics(s);
case SpellID::DEATH_STARE:
return new DeathStareMechanics(s);
case SpellID::DISPEL:
return new DispellMechanics(s);
case SpellID::DISPEL_HELPFUL_SPELLS:
return new DispellHelpfulMechanics(s);
case SpellID::EARTHQUAKE:
return new EarthquakeMechanics(s);
case SpellID::FIRE_WALL:
case SpellID::FORCE_FIELD:
return new WallMechanics(s);
case SpellID::HYPNOTIZE:
return new HypnotizeMechanics(s);
case SpellID::LAND_MINE:
case SpellID::QUICKSAND:
return new ObstacleMechanics(s);
case SpellID::REMOVE_OBSTACLE:
return new RemoveObstacleMechanics(s);
case SpellID::SACRIFICE:
return new SacrificeMechanics(s);
case SpellID::SUMMON_FIRE_ELEMENTAL:
return new SummonMechanics(s, CreatureID::FIRE_ELEMENTAL);
case SpellID::SUMMON_EARTH_ELEMENTAL:
return new SummonMechanics(s, CreatureID::EARTH_ELEMENTAL);
case SpellID::SUMMON_WATER_ELEMENTAL:
return new SummonMechanics(s, CreatureID::WATER_ELEMENTAL);
case SpellID::SUMMON_AIR_ELEMENTAL:
return new SummonMechanics(s, CreatureID::AIR_ELEMENTAL);
case SpellID::TELEPORT:
return new TeleportMechanics(s);
case SpellID::SUMMON_BOAT:
return new SummonBoatMechanics(s);
case SpellID::SCUTTLE_BOAT:
return new ScuttleBoatMechanics(s);
case SpellID::DIMENSION_DOOR:
return new DimensionDoorMechanics(s);
case SpellID::FLY:
case SpellID::WATER_WALK:
case SpellID::VISIONS:
case SpellID::DISGUISE:
return new DefaultSpellMechanics(s); //implemented using bonus system
case SpellID::TOWN_PORTAL:
return new TownPortalMechanics(s);
case SpellID::VIEW_EARTH:
return new ViewEarthMechanics(s);
case SpellID::VIEW_AIR:
return new ViewAirMechanics(s);
default:
if(s->isRisingSpell())
return new SpecialRisingSpellMechanics(s);
else
return new DefaultSpellMechanics(s);
}
}