2014-11-12 10:36:34 +02:00
|
|
|
/*
|
2015-02-02 11:22:19 +02:00
|
|
|
* ISpellMechanics.cpp, part of VCMI engine
|
2014-11-12 10:36:34 +02:00
|
|
|
*
|
|
|
|
* 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"
|
2015-02-02 10:25:26 +02:00
|
|
|
#include "ISpellMechanics.h"
|
2014-11-12 10:36:34 +02:00
|
|
|
|
2015-02-02 11:22:19 +02:00
|
|
|
#include "CDefaultSpellMechanics.h"
|
2014-11-12 10:36:34 +02:00
|
|
|
|
2015-02-02 11:22:19 +02:00
|
|
|
#include "AdventureSpellMechanics.h"
|
|
|
|
#include "BattleSpellMechanics.h"
|
|
|
|
#include "CreatureSpellMechanics.h"
|
2014-11-13 03:53:25 +02:00
|
|
|
|
2014-11-25 14:00:34 +02:00
|
|
|
|
2014-11-13 06:34:20 +02:00
|
|
|
///ISpellMechanics
|
|
|
|
ISpellMechanics::ISpellMechanics(CSpell * s):
|
|
|
|
owner(s)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
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-02 11:22:19 +02:00
|
|
|
return new DeathStareMechanics(s);
|
2014-11-25 22:59:21 +02:00
|
|
|
case SpellID::DISPEL:
|
|
|
|
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:
|
|
|
|
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:
|
2014-12-25 23:02:50 +02:00
|
|
|
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:
|
|
|
|
return new AdventureBonusingMechanics(s, Bonus::FLYING_MOVEMENT);
|
|
|
|
case SpellID::WATER_WALK:
|
|
|
|
return new AdventureBonusingMechanics(s, Bonus::WATER_WALKING);
|
|
|
|
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::VISIONS:
|
|
|
|
case SpellID::VIEW_EARTH:
|
|
|
|
case SpellID::DISGUISE:
|
|
|
|
case SpellID::VIEW_AIR:
|
2014-11-25 13:58:42 +02:00
|
|
|
default:
|
|
|
|
if(s->isRisingSpell())
|
|
|
|
return new SpecialRisingSpellMechanics(s);
|
|
|
|
else
|
|
|
|
return new DefaultSpellMechanics(s);
|
|
|
|
}
|
|
|
|
}
|