ISpellMechanics.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. case SpellID::WATER_WALK:
  66. case SpellID::VISIONS:
  67. case SpellID::DISGUISE:
  68. return new DefaultSpellMechanics(s); //implemented using bonus system
  69. case SpellID::TOWN_PORTAL:
  70. return new TownPortalMechanics(s);
  71. case SpellID::VIEW_EARTH:
  72. return new ViewEarthMechanics(s);
  73. case SpellID::VIEW_AIR:
  74. return new ViewAirMechanics(s);
  75. default:
  76. if(s->isRisingSpell())
  77. return new SpecialRisingSpellMechanics(s);
  78. else
  79. return new DefaultSpellMechanics(s);
  80. }
  81. }