public override bool CastAtTarget(IntVector2 target) { Actor currentCaster = _scene.GetGameObjectPool().GetActor(OwnerID); //Can't cast on yourself! if (target == currentCaster.Position) { return(false); } List <int> targets = _scene.GetActorsAtPosition(target); //We can't cast if there's nobody there if (targets.Count == 0) { return(false); } Actor tgtActor = _scene.GetGameObjectPool().GetActor(targets[0]); _scene.WriteMessage("You begin to magically flay the creature apart!"); _activeBehaviorID = _scene.GetGameObjectPool().CreateActorBehavior("b_damageOverTime", this.OwnerID); ActorBehavior_DamageOverTime behavior = (ActorBehavior_DamageOverTime)_scene.GetGameObjectPool().GetActorBehavior(_activeBehaviorID); behavior.ParentAbility = this; behavior.Damage.Magnitude = 2; behavior.Damage.DmgElement = ElementType.PHYSICAL; behavior.AffectedActor = tgtActor.InstanceID; behavior.TurnsRemaining = 5; tgtActor.AddBehavior(_activeBehaviorID); IsActive = true; return(true); }
public int CreateActorBehavior(string actorBehaviorType, int casterID) { GameObject obj = null; if (actorBehaviorType == "b_genericShield") { obj = new ActorBehavior_GenericShield(GetNextID(), casterID); } else if (actorBehaviorType == "b_genericBuff") { obj = new ActorBehavior_GenericBuff(GetNextID(), casterID); } else if (actorBehaviorType == "b_astralConduit") { obj = new ActorBehavior_AstralConduit(GetNextID(), casterID); } else if (actorBehaviorType == "b_enemyMagicShield") { obj = new ActorBehavior_EnemyMagicShield(GetNextID(), casterID); } else if (actorBehaviorType == "b_damageOverTime") { obj = new ActorBehavior_DamageOverTime(GetNextID(), casterID); } else if (actorBehaviorType == "b_stun") { obj = new ActorBehavior_Stun(GetNextID(), casterID); } else if (actorBehaviorType == "b_invincibility") { obj = new ActorBehavior_Invincibility(GetNextID(), casterID); } else if (actorBehaviorType == "b_xrayVision") { obj = new ActorBehavior_XrayVision(GetNextID(), casterID); } else if (actorBehaviorType == "b_energize") { obj = new ActorBehavior_Energize(GetNextID(), casterID); } else if (actorBehaviorType == "b_boundSpirit") { obj = new ActorBehavior_BoundSpirit(GetNextID(), casterID); } else if (actorBehaviorType == "b_scaledSkin") { obj = new ActorBehavior_ScaledSkin(GetNextID(), casterID); } else { throw new NotImplementedException(); } return(RegisterGameObject(obj)); }