ISpellMechanics.cpp 2.5 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::ACID_BREATH_DAMAGE:
  26. return new AcidBreathDamageMechanics(s);
  27. case SpellID::CHAIN_LIGHTNING:
  28. return new ChainLightningMechanics(s);
  29. case SpellID::CLONE:
  30. return new CloneMechanics(s);
  31. case SpellID::CURE:
  32. return new CureMechanics(s);
  33. case SpellID::DEATH_STARE:
  34. return new DeathStareMechanics(s);
  35. case SpellID::DISPEL:
  36. return new DispellMechanics(s);
  37. case SpellID::DISPEL_HELPFUL_SPELLS:
  38. return new DispellHelpfulMechanics(s);
  39. case SpellID::FIRE_WALL:
  40. case SpellID::FORCE_FIELD:
  41. return new WallMechanics(s);
  42. case SpellID::HYPNOTIZE:
  43. return new HypnotizeMechanics(s);
  44. case SpellID::LAND_MINE:
  45. case SpellID::QUICKSAND:
  46. return new ObstacleMechanics(s);
  47. case SpellID::REMOVE_OBSTACLE:
  48. return new RemoveObstacleMechanics(s);
  49. case SpellID::SACRIFICE:
  50. return new SacrificeMechanics(s);
  51. case SpellID::SUMMON_FIRE_ELEMENTAL:
  52. case SpellID::SUMMON_EARTH_ELEMENTAL:
  53. case SpellID::SUMMON_WATER_ELEMENTAL:
  54. case SpellID::SUMMON_AIR_ELEMENTAL:
  55. return new SummonMechanics(s);
  56. case SpellID::TELEPORT:
  57. return new TeleportMechanics(s);
  58. case SpellID::SUMMON_BOAT:
  59. return new SummonBoatMechanics(s);
  60. case SpellID::SCUTTLE_BOAT:
  61. return new ScuttleBoatMechanics(s);
  62. case SpellID::DIMENSION_DOOR:
  63. return new DimensionDoorMechanics(s);
  64. case SpellID::FLY:
  65. return new FlyMechanics(s, Bonus::FLYING_MOVEMENT); //temporary
  66. case SpellID::WATER_WALK:
  67. return new FlyMechanics(s, Bonus::WATER_WALKING); //temporary
  68. case SpellID::TOWN_PORTAL:
  69. return new TownPortalMechanics(s);
  70. case SpellID::VIEW_EARTH:
  71. return new ViewEarthMechanics(s);
  72. case SpellID::VIEW_AIR:
  73. return new ViewAirMechanics(s);
  74. case SpellID::VISIONS:
  75. return new VisionsMechanics(s, Bonus::VISIONS); //temporary
  76. case SpellID::DISGUISE:
  77. return new VisionsMechanics(s, Bonus::DISGUISED); //temporary
  78. default:
  79. if(s->isRisingSpell())
  80. return new SpecialRisingSpellMechanics(s);
  81. else
  82. return new DefaultSpellMechanics(s);
  83. }
  84. }