ISpellMechanics.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. case SpellID::SUMMON_EARTH_ELEMENTAL:
  57. case SpellID::SUMMON_WATER_ELEMENTAL:
  58. case SpellID::SUMMON_AIR_ELEMENTAL:
  59. return new SummonMechanics(s);
  60. case SpellID::TELEPORT:
  61. return new TeleportMechanics(s);
  62. case SpellID::SUMMON_BOAT:
  63. return new SummonBoatMechanics(s);
  64. case SpellID::SCUTTLE_BOAT:
  65. return new ScuttleBoatMechanics(s);
  66. case SpellID::DIMENSION_DOOR:
  67. return new DimensionDoorMechanics(s);
  68. case SpellID::FLY:
  69. case SpellID::WATER_WALK:
  70. case SpellID::VISIONS:
  71. case SpellID::DISGUISE:
  72. return new DefaultSpellMechanics(s); //implemented using bonus system
  73. case SpellID::TOWN_PORTAL:
  74. return new TownPortalMechanics(s);
  75. case SpellID::VIEW_EARTH:
  76. return new ViewEarthMechanics(s);
  77. case SpellID::VIEW_AIR:
  78. return new ViewAirMechanics(s);
  79. default:
  80. if(s->isRisingSpell())
  81. return new SpecialRisingSpellMechanics(s);
  82. else
  83. return new DefaultSpellMechanics(s);
  84. }
  85. }