public override void SetAttackTarget(EntityAlive _attackTarget, int _attackTargetTime)
    {
        if (_attackTarget != null)
        {
            if (_attackTarget.IsDead())
            {
                return;
            }
        }


        if (_attackTarget == null)
        {
            // Some of the AI tasks resets the attack target when it falls down stunned; this will prevent the NPC from ignoring its stunned opponent.
            if (attackTarget != null && attackTarget.IsAlive())
            {
                return;
            }

            // Reset the hand held back to their preferred item 0
            // EntityUtilities.ChangeHandholdItem(this.entityId, EntityUtilities.Need.Ranged, 0);
        }

        base.SetAttackTarget(_attackTarget, _attackTargetTime);
        // Debug.Log("Adding Buff for Attack Target() ");
        Buffs.AddBuff("buffNotifyTeamAttack", -1, true);
    }
    public new void SetRevengeTarget(EntityAlive _other)
    {
        if (_other)
        {
            // Forgive friendly fire, even from explosions.
            EntityAlive myLeader = EntityUtilities.GetLeaderOrOwner(entityId) as EntityAlive;
            if (myLeader)
            {
                if (myLeader.entityId == _other.entityId)
                {
                    return;
                }
            }
            if (EntityUtilities.IsAnAlly(entityId, _other.entityId))
            {
                return;
            }

            if (_other.IsDead())
            {
                return;
            }
        }

        base.SetRevengeTarget(_other);
        //  Debug.Log("Adding Buff for RevengeTarget() ");
        Buffs.AddBuff("buffNotifyTeamAttack", -1, true);
    }
    public override void SetRevengeTarget(EntityAlive _other)
    {
        if (_other)
        {
            // Forgive friendly fire, even from explosions.
            EntityAlive myLeader = EntityUtilities.GetLeaderOrOwner(entityId) as EntityAlive;
            if (myLeader)
            {
                if (myLeader.entityId == _other.entityId)
                {
                    return;
                }
            }
            if (EntityUtilities.IsAnAlly(entityId, _other.entityId))
            {
                return;
            }

            if (_other.IsDead())
            {
                return;
            }
        }

        //if (_other == null)
        //{
        //    // Reset the hand held back to their preferred item 0
        //    EntityUtilities.ChangeHandholdItem(this.entityId, EntityUtilities.Need.Ranged, 0);
        //}

        base.SetRevengeTarget(_other);
        //  Debug.Log("Adding Buff for RevengeTarget() ");
        Buffs.AddBuff("buffNotifyTeamAttack", -1, true);
    }
Esempio n. 4
0
    private static int AddBuff(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 3);
            Buffs buffs     = (Buffs)ToLua.CheckObject(L, 1, typeof(Buffs));
            int   buff_id   = (int)LuaDLL.luaL_checknumber(L, 2);
            int   buffEffId = (int)LuaDLL.luaL_checknumber(L, 3);
            buffs.AddBuff(buff_id, buffEffId);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 5
0
        public void TryActivateHide()
        {
            if (!IsGM || GMHideEnabled)
            {
                return;
            }

            var hideSkill = Constants.Gm.Skills.Hide;

            // Make sure that the user has the skill
            if (Skills.GetSkillLevel(hideSkill) == 0)
            {
                Skills.AddSkillPoint(hideSkill);
            }

            if (!Undercover)
            {
                Buffs.AddBuff(hideSkill, 1);
                SetHide(true, true);
            }
        }
Esempio n. 6
0
    public override void SetAttackTarget(EntityAlive _attackTarget, int _attackTargetTime)
    {
        if (_attackTarget != null)
        {
            if (_attackTarget.IsDead())
            {
                return;
            }
        }


        if (_attackTarget == null)
        {
            // Reset the hand held back to their preferred item 0
            EntityUtilities.ChangeHandholdItem(this.entityId, EntityUtilities.Need.Ranged, 0);
        }

        base.SetAttackTarget(_attackTarget, _attackTargetTime);
        // Debug.Log("Adding Buff for Attack Target() ");
        Buffs.AddBuff("buffNotifyTeamAttack", -1, true);
    }
    public new void SetAttackTarget(EntityAlive _attackTarget, int _attackTargetTime)
    {
        if (_attackTarget != null)
        {
            if (_attackTarget.IsDead())
            {
                return;
            }
        }


        if (_attackTarget == null)
        {
            // Some of the AI tasks resets the attack target when it falls down stunned; this will prevent the NPC from ignoring its stunned opponent.
            if (attackTarget != null && attackTarget.IsAlive())
            {
                return;
            }
        }

        base.SetAttackTarget(_attackTarget, _attackTargetTime);
        // Debug.Log("Adding Buff for Attack Target() ");
        Buffs.AddBuff("buffNotifyTeamAttack", -1, true);
    }
Esempio n. 8
0
 /// <summary>
 /// Causes the effect.
 /// </summary>
 public override void CauseEffect()
 {
     target.AddBuff(buff);
 }
Esempio n. 9
0
        public override void Update(GameTime gameTime)
        {
            if (this != Game1.Player)
            {
                return;
            }

            if (KeyboardUtil.KeyPressed(Keys.L))
            {
                weapon = new Gunderwear();
            }

            if (KeyboardUtil.KeyPressed(Keys.H))
            {
                health--;
            }
            if (health < 0)
            {
                health++;
            }

            if (siegeOfMadoka)
            {
                somSpawnTime += gameTime.ElapsedGameTime.Milliseconds;
                if (somSpawnTime >= 1750)
                {
                    var rsm = new Reallystupidmadoka();
                    Owner.AddEntity(rsm);
                    somSpawnTime = 0;
                }
                float shortestDist = Game1.TileSize * 16;
                foreach (var i in Owner.Entities.Values)
                {
                    if (i is Reallystupidmadoka)
                    {
                        float dist = Vector2.Distance(i.XandY, this.XandY);
                        if (dist < shortestDist)
                        {
                            shortestDist = dist;
                        }
                    }
                }
                Music.Volume(Math.Max(0, (1 - (shortestDist / (Game1.TileSize * 14))) * 0.3f));
            }

            if (KeyboardUtil.KeyPressed(Keys.F2))
            {
                var tilePos = Utility.GetTilePos(X, Y);
                Owner.AddEntity(new Stupidmadoka(tilePos.X, tilePos.Y));
            }
            if (KeyboardUtil.KeyPressed(Keys.F3))
            {
                var tilePos = Utility.GetTilePos(X, Y);
                Owner.AddEntity(new Enemy(tilePos.X, tilePos.Y));
            }
            if (KeyboardUtil.KeyPressed(Keys.F4))
            {
                siegeOfMadoka = !siegeOfMadoka;
            }

            int speed = 3;

            if (KeyboardUtil.IsKeyDown(Keys.LeftShift))
            {
                speed = 24;
            }

            Vector2 move = new Vector2(0, 0);

            if (KeyboardUtil.IsKeyDown(Keys.W))
            {
                move.Y -= 1;
            }
            if (KeyboardUtil.IsKeyDown(Keys.S))
            {
                move.Y += 1;
            }
            if (KeyboardUtil.IsKeyDown(Keys.A))
            {
                move.X -= 1;
            }
            if (KeyboardUtil.IsKeyDown(Keys.D))
            {
                move.X += 1;
            }
            if (KeyboardUtil.KeyPressed(Keys.Y))
            {
                Buffs.AddBuff(BuffType.Speed, 1000, 2);
            }
            if (Game1.Player.Inventory[1] == Item.Sword2 && (weapon is Gunderwear))
            {
                weapon = new Crossbow();
            }
            if (Game1.Player.Inventory[1] == Item.Sword && !(weapon is Gunderwear))
            {
                weapon = new Gunderwear();
            }
            if (move.X > 0)
            {
                this.facing = 0;
            }
            if (move.X < 0)
            {
                this.facing = 1;
            }

            if (weapon != null)
            {
                weapon.Update(gameTime);
            }

            move *= (speed * speedMult);
            if (move.X != 0 && move.Y != 0)
            {
                move.X /= (float)Math.Sqrt(2);
                move.Y /= (float)Math.Sqrt(2);
            }

            if (move.X != 0 || move.Y != 0)
            {
                if (this.frameCount == 0)
                {
                    this.frameCount = 32;
                }
                else
                {
                    this.frameCount += 3;
                }
            }
            else
            {
                this.frameCount = 0;
            }
            this.frame = (int)Math.Floor(frameCount / 32.0) % 4;

            if (speed == 24)
            {
                Owner.AddEntity(new FakePlayer(this.X, this.Y, this.facing, this.frame));
            }

            string[] collisions = new string[] { "Solid", "NPC" };
            var      cbox       = GetCollisionBox();

            if (move.X != 0 && move.Y != 0)
            {
                float prevX = this.X;
                float prevY = this.Y;
                if (!Owner.RectCollidesWith(new Rectangle(cbox.X + (int)move.X, cbox.Y, cbox.Width, cbox.Height), collisions))
                {
                    this.X += move.X;
                }
                if (!Owner.RectCollidesWith(new Rectangle(cbox.X, cbox.Y + (int)move.Y, cbox.Width, cbox.Height), collisions))
                {
                    this.Y += move.Y;
                }
                if (Owner.RectCollidesWith(GetCollisionBox(), collisions))
                {
                    this.X = prevX;
                    this.Y = prevY;
                }
            }
            else
            {
                float prevX = this.X;
                float prevY = this.Y;
                this.X += move.X;
                this.Y += move.Y;
                if (Owner.RectCollidesWith(GetCollisionBox(), collisions))
                {
                    this.X = prevX;
                    this.Y = prevY;
                }
            }
        }