|
@@ -83,72 +83,87 @@ ISpellMechanics::ISpellMechanics(CSpell * s):
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-ISpellMechanics * ISpellMechanics::createMechanics(CSpell * s)
|
|
|
|
|
|
+std::unique_ptr<ISpellMechanics> ISpellMechanics::createMechanics(CSpell * s)
|
|
{
|
|
{
|
|
switch (s->id)
|
|
switch (s->id)
|
|
{
|
|
{
|
|
case SpellID::ANTI_MAGIC:
|
|
case SpellID::ANTI_MAGIC:
|
|
- return new AntimagicMechanics(s);
|
|
|
|
|
|
+ return make_unique<AntimagicMechanics>(s);
|
|
case SpellID::ACID_BREATH_DAMAGE:
|
|
case SpellID::ACID_BREATH_DAMAGE:
|
|
- return new AcidBreathDamageMechanics(s);
|
|
|
|
|
|
+ return make_unique<AcidBreathDamageMechanics>(s);
|
|
case SpellID::CHAIN_LIGHTNING:
|
|
case SpellID::CHAIN_LIGHTNING:
|
|
- return new ChainLightningMechanics(s);
|
|
|
|
|
|
+ return make_unique<ChainLightningMechanics>(s);
|
|
case SpellID::CLONE:
|
|
case SpellID::CLONE:
|
|
- return new CloneMechanics(s);
|
|
|
|
|
|
+ return make_unique<CloneMechanics>(s);
|
|
case SpellID::CURE:
|
|
case SpellID::CURE:
|
|
- return new CureMechanics(s);
|
|
|
|
|
|
+ return make_unique<CureMechanics>(s);
|
|
case SpellID::DEATH_STARE:
|
|
case SpellID::DEATH_STARE:
|
|
- return new DeathStareMechanics(s);
|
|
|
|
|
|
+ return make_unique<DeathStareMechanics>(s);
|
|
case SpellID::DISPEL:
|
|
case SpellID::DISPEL:
|
|
- return new DispellMechanics(s);
|
|
|
|
|
|
+ return make_unique<DispellMechanics>(s);
|
|
case SpellID::DISPEL_HELPFUL_SPELLS:
|
|
case SpellID::DISPEL_HELPFUL_SPELLS:
|
|
- return new DispellHelpfulMechanics(s);
|
|
|
|
|
|
+ return make_unique<DispellHelpfulMechanics>(s);
|
|
case SpellID::EARTHQUAKE:
|
|
case SpellID::EARTHQUAKE:
|
|
- return new EarthquakeMechanics(s);
|
|
|
|
|
|
+ return make_unique<EarthquakeMechanics>(s);
|
|
case SpellID::FIRE_WALL:
|
|
case SpellID::FIRE_WALL:
|
|
case SpellID::FORCE_FIELD:
|
|
case SpellID::FORCE_FIELD:
|
|
- return new WallMechanics(s);
|
|
|
|
|
|
+ return make_unique<WallMechanics>(s);
|
|
case SpellID::HYPNOTIZE:
|
|
case SpellID::HYPNOTIZE:
|
|
- return new HypnotizeMechanics(s);
|
|
|
|
|
|
+ return make_unique<HypnotizeMechanics>(s);
|
|
case SpellID::LAND_MINE:
|
|
case SpellID::LAND_MINE:
|
|
case SpellID::QUICKSAND:
|
|
case SpellID::QUICKSAND:
|
|
- return new ObstacleMechanics(s);
|
|
|
|
|
|
+ return make_unique<ObstacleMechanics>(s);
|
|
case SpellID::REMOVE_OBSTACLE:
|
|
case SpellID::REMOVE_OBSTACLE:
|
|
- return new RemoveObstacleMechanics(s);
|
|
|
|
|
|
+ return make_unique<RemoveObstacleMechanics>(s);
|
|
case SpellID::SACRIFICE:
|
|
case SpellID::SACRIFICE:
|
|
- return new SacrificeMechanics(s);
|
|
|
|
|
|
+ return make_unique<SacrificeMechanics>(s);
|
|
case SpellID::SUMMON_FIRE_ELEMENTAL:
|
|
case SpellID::SUMMON_FIRE_ELEMENTAL:
|
|
- return new SummonMechanics(s, CreatureID::FIRE_ELEMENTAL);
|
|
|
|
|
|
+ return make_unique<SummonMechanics>(s, CreatureID::FIRE_ELEMENTAL);
|
|
case SpellID::SUMMON_EARTH_ELEMENTAL:
|
|
case SpellID::SUMMON_EARTH_ELEMENTAL:
|
|
- return new SummonMechanics(s, CreatureID::EARTH_ELEMENTAL);
|
|
|
|
|
|
+ return make_unique<SummonMechanics>(s, CreatureID::EARTH_ELEMENTAL);
|
|
case SpellID::SUMMON_WATER_ELEMENTAL:
|
|
case SpellID::SUMMON_WATER_ELEMENTAL:
|
|
- return new SummonMechanics(s, CreatureID::WATER_ELEMENTAL);
|
|
|
|
|
|
+ return make_unique<SummonMechanics>(s, CreatureID::WATER_ELEMENTAL);
|
|
case SpellID::SUMMON_AIR_ELEMENTAL:
|
|
case SpellID::SUMMON_AIR_ELEMENTAL:
|
|
- return new SummonMechanics(s, CreatureID::AIR_ELEMENTAL);
|
|
|
|
|
|
+ return make_unique<SummonMechanics>(s, CreatureID::AIR_ELEMENTAL);
|
|
case SpellID::TELEPORT:
|
|
case SpellID::TELEPORT:
|
|
- return new TeleportMechanics(s);
|
|
|
|
|
|
+ return make_unique<TeleportMechanics>(s);
|
|
|
|
+ default:
|
|
|
|
+ if(s->isRisingSpell())
|
|
|
|
+ return make_unique<SpecialRisingSpellMechanics>(s);
|
|
|
|
+ else
|
|
|
|
+ return make_unique<DefaultSpellMechanics>(s);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//IAdventureSpellMechanics
|
|
|
|
+IAdventureSpellMechanics::IAdventureSpellMechanics(CSpell * s):
|
|
|
|
+ owner(s)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+std::unique_ptr<IAdventureSpellMechanics> IAdventureSpellMechanics::createMechanics(CSpell * s)
|
|
|
|
+{
|
|
|
|
+ switch (s->id)
|
|
|
|
+ {
|
|
case SpellID::SUMMON_BOAT:
|
|
case SpellID::SUMMON_BOAT:
|
|
- return new SummonBoatMechanics(s);
|
|
|
|
|
|
+ return make_unique<SummonBoatMechanics>(s);
|
|
case SpellID::SCUTTLE_BOAT:
|
|
case SpellID::SCUTTLE_BOAT:
|
|
- return new ScuttleBoatMechanics(s);
|
|
|
|
|
|
+ return make_unique<ScuttleBoatMechanics>(s);
|
|
case SpellID::DIMENSION_DOOR:
|
|
case SpellID::DIMENSION_DOOR:
|
|
- return new DimensionDoorMechanics(s);
|
|
|
|
|
|
+ return make_unique<DimensionDoorMechanics>(s);
|
|
case SpellID::FLY:
|
|
case SpellID::FLY:
|
|
case SpellID::WATER_WALK:
|
|
case SpellID::WATER_WALK:
|
|
case SpellID::VISIONS:
|
|
case SpellID::VISIONS:
|
|
case SpellID::DISGUISE:
|
|
case SpellID::DISGUISE:
|
|
- return new DefaultSpellMechanics(s); //implemented using bonus system
|
|
|
|
|
|
+ return make_unique<AdventureSpellMechanics>(s); //implemented using bonus system
|
|
case SpellID::TOWN_PORTAL:
|
|
case SpellID::TOWN_PORTAL:
|
|
- return new TownPortalMechanics(s);
|
|
|
|
|
|
+ return make_unique<TownPortalMechanics>(s);
|
|
case SpellID::VIEW_EARTH:
|
|
case SpellID::VIEW_EARTH:
|
|
- return new ViewEarthMechanics(s);
|
|
|
|
|
|
+ return make_unique<ViewEarthMechanics>(s);
|
|
case SpellID::VIEW_AIR:
|
|
case SpellID::VIEW_AIR:
|
|
- return new ViewAirMechanics(s);
|
|
|
|
|
|
+ return make_unique<ViewAirMechanics>(s);
|
|
default:
|
|
default:
|
|
- if(s->isRisingSpell())
|
|
|
|
- return new SpecialRisingSpellMechanics(s);
|
|
|
|
- else
|
|
|
|
- return new DefaultSpellMechanics(s);
|
|
|
|
|
|
+ return std::unique_ptr<IAdventureSpellMechanics>();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|