ISpellMechanics.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * ISpellMechanics.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "ISpellMechanics.h"
  12. #include "CDefaultSpellMechanics.h"
  13. #include "AdventureSpellMechanics.h"
  14. #include "BattleSpellMechanics.h"
  15. #include "CreatureSpellMechanics.h"
  16. ///ISpellMechanics
  17. ISpellMechanics::ISpellMechanics(CSpell * s):
  18. owner(s)
  19. {
  20. }
  21. ISpellMechanics * ISpellMechanics::createMechanics(CSpell * s)
  22. {
  23. switch (s->id)
  24. {
  25. case SpellID::ANTI_MAGIC:
  26. return new AntimagicMechanics(s);
  27. case SpellID::ACID_BREATH_DAMAGE:
  28. return new AcidBreathDamageMechanics(s);
  29. case SpellID::CHAIN_LIGHTNING:
  30. return new ChainLightningMechanics(s);
  31. case SpellID::CLONE:
  32. return new CloneMechanics(s);
  33. case SpellID::CURE:
  34. return new CureMechanics(s);
  35. case SpellID::DEATH_STARE:
  36. return new DeathStareMechanics(s);
  37. case SpellID::DISPEL:
  38. return new DispellMechanics(s);
  39. case SpellID::DISPEL_HELPFUL_SPELLS:
  40. return new DispellHelpfulMechanics(s);
  41. case SpellID::EARTHQUAKE:
  42. return new EarthquakeMechanics(s);
  43. case SpellID::FIRE_WALL:
  44. case SpellID::FORCE_FIELD:
  45. return new WallMechanics(s);
  46. case SpellID::HYPNOTIZE:
  47. return new HypnotizeMechanics(s);
  48. case SpellID::LAND_MINE:
  49. case SpellID::QUICKSAND:
  50. return new ObstacleMechanics(s);
  51. case SpellID::REMOVE_OBSTACLE:
  52. return new RemoveObstacleMechanics(s);
  53. case SpellID::SACRIFICE:
  54. return new SacrificeMechanics(s);
  55. case SpellID::SUMMON_FIRE_ELEMENTAL:
  56. return new SummonMechanics(s, CreatureID::FIRE_ELEMENTAL);
  57. case SpellID::SUMMON_EARTH_ELEMENTAL:
  58. return new SummonMechanics(s, CreatureID::EARTH_ELEMENTAL);
  59. case SpellID::SUMMON_WATER_ELEMENTAL:
  60. return new SummonMechanics(s, CreatureID::WATER_ELEMENTAL);
  61. case SpellID::SUMMON_AIR_ELEMENTAL:
  62. return new SummonMechanics(s, CreatureID::AIR_ELEMENTAL);
  63. case SpellID::TELEPORT:
  64. return new TeleportMechanics(s);
  65. case SpellID::SUMMON_BOAT:
  66. return new SummonBoatMechanics(s);
  67. case SpellID::SCUTTLE_BOAT:
  68. return new ScuttleBoatMechanics(s);
  69. case SpellID::DIMENSION_DOOR:
  70. return new DimensionDoorMechanics(s);
  71. case SpellID::FLY:
  72. case SpellID::WATER_WALK:
  73. case SpellID::VISIONS:
  74. case SpellID::DISGUISE:
  75. return new DefaultSpellMechanics(s); //implemented using bonus system
  76. case SpellID::TOWN_PORTAL:
  77. return new TownPortalMechanics(s);
  78. case SpellID::VIEW_EARTH:
  79. return new ViewEarthMechanics(s);
  80. case SpellID::VIEW_AIR:
  81. return new ViewAirMechanics(s);
  82. default:
  83. if(s->isRisingSpell())
  84. return new SpecialRisingSpellMechanics(s);
  85. else
  86. return new DefaultSpellMechanics(s);
  87. }
  88. }