1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00
vcmi/lib/spells/ISpellMechanics.cpp

88 lines
2.3 KiB
C++
Raw Normal View History

/*
2015-02-02 11:22:19 +02:00
* 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"
2015-02-02 11:22:19 +02:00
#include "CDefaultSpellMechanics.h"
2015-02-02 11:22:19 +02:00
#include "AdventureSpellMechanics.h"
#include "BattleSpellMechanics.h"
#include "CreatureSpellMechanics.h"
///ISpellMechanics
ISpellMechanics::ISpellMechanics(CSpell * s):
owner(s)
{
2015-02-26 19:59:18 +02:00
}
2014-11-25 17:27:18 +02:00
ISpellMechanics * ISpellMechanics::createMechanics(CSpell * s)
2014-11-25 13:58:42 +02:00
{
switch (s->id)
{
2014-11-25 22:59:21 +02:00
case SpellID::ACID_BREATH_DAMAGE:
2015-02-02 11:22:19 +02:00
return new AcidBreathDamageMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::CHAIN_LIGHTNING:
2015-02-26 19:59:18 +02:00
return new ChainLightningMechanics(s);
2014-11-25 13:58:42 +02:00
case SpellID::CLONE:
return new CloneMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::CURE:
return new CureMechanics(s);
case SpellID::DEATH_STARE:
2015-02-26 19:59:18 +02:00
return new DeathStareMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::DISPEL:
2015-02-26 19:59:18 +02:00
return new DispellMechanics(s);
2014-11-25 13:58:42 +02:00
case SpellID::DISPEL_HELPFUL_SPELLS:
return new DispellHelpfulMechanics(s);
case SpellID::FIRE_WALL:
case SpellID::FORCE_FIELD:
2015-02-26 19:59:18 +02:00
return new WallMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::HYPNOTIZE:
return new HypnotizeMechanics(s);
2014-11-25 13:58:42 +02:00
case SpellID::LAND_MINE:
case SpellID::QUICKSAND:
return new ObstacleMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::REMOVE_OBSTACLE:
return new RemoveObstacleMechanics(s);
case SpellID::SACRIFICE:
return new SacrificeMechanics(s);
2014-11-25 16:35:20 +02:00
case SpellID::SUMMON_FIRE_ELEMENTAL:
case SpellID::SUMMON_EARTH_ELEMENTAL:
case SpellID::SUMMON_WATER_ELEMENTAL:
case SpellID::SUMMON_AIR_ELEMENTAL:
return new SummonMechanics(s);
2014-11-25 22:59:21 +02:00
case SpellID::TELEPORT:
2015-02-26 19:59:18 +02:00
return new TeleportMechanics(s);
2014-12-25 23:02:50 +02:00
case SpellID::SUMMON_BOAT:
return new SummonBoatMechanics(s);
2015-02-26 19:59:18 +02:00
case SpellID::SCUTTLE_BOAT:
return new ScuttleBoatMechanics(s);
2014-12-25 23:02:50 +02:00
case SpellID::DIMENSION_DOOR:
return new DimensionDoorMechanics(s);
case SpellID::FLY:
case SpellID::WATER_WALK:
2015-02-06 14:41:26 +02:00
case SpellID::VISIONS:
case SpellID::DISGUISE:
return new DefaultSpellMechanics(s); //implemented using bonus system
2014-12-25 23:02:50 +02:00
case SpellID::TOWN_PORTAL:
2014-12-25 23:11:37 +02:00
return new TownPortalMechanics(s);
2014-12-25 23:02:50 +02:00
case SpellID::VIEW_EARTH:
return new ViewEarthMechanics(s);
2015-02-26 19:59:18 +02:00
case SpellID::VIEW_AIR:
return new ViewAirMechanics(s);
2015-02-26 19:59:18 +02:00
default:
2014-11-25 13:58:42 +02:00
if(s->isRisingSpell())
return new SpecialRisingSpellMechanics(s);
2015-02-26 19:59:18 +02:00
else
return new DefaultSpellMechanics(s);
}
2014-11-25 13:58:42 +02:00
}