Пример #1
0
        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("The monster falls into a magical sleep!");

            _activeBehaviorID = _scene.GetGameObjectPool().CreateActorBehavior("b_stun", this.OwnerID);
            ActorBehavior_Stun behavior = (ActorBehavior_Stun)_scene.GetGameObjectPool().GetActorBehavior(_activeBehaviorID);

            behavior.ParentAbility  = this;
            behavior.AffectedActor  = tgtActor.InstanceID;
            behavior.TurnsRemaining = 999;

            tgtActor.AddBehavior(_activeBehaviorID);

            IsActive = true;

            return(true);
        }
Пример #2
0
        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));
        }