private void UpdateAnimaBehaviors()
        {
            bool isNew = false;

            if (EnlivenedBuff.CanBuff(this.player, this.AnimaPercent))
            {
                isNew = this.ApplyEnlivened();
            }
            else if (NecrotisNatusDeBuff.CanBuff(this.player, this.AnimaPercent))
            {
                isNew = this.ApplyNecrotisNatus();
            }
            else if (NecrotisOmnisDeBuff.CanBuff(this.player, this.AnimaPercent))
            {
                isNew = this.ApplyNecrotisOmnis();
            }

            if (isNew)
            {
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    PlayerAnimaSyncProtocol.Broadcast(this);
                }
            }
        }
예제 #2
0
        ////////////////

        public void SubtractAnimaPercent(float percentLost, bool quiet, bool sync)
        {
            if (percentLost == 0)
            {
                return;
            }

            float old = this.AnimaPercent;

            /*// If afflicted
             * if( this.AnimaPercent < 0.5f ) {
             *      // Reduce amount of added affliction
             *      if( percentAmt > 0f ) {
             *              percentAmt *= 0.25f;
             *      }
             * }*/

            this.AnimaPercent -= percentLost;
            if (this.AnimaPercent < 0f)
            {
                this.AnimaPercent = 0f;
            }
            else if (this.AnimaPercent > 1f)
            {
                this.AnimaPercent = 1f;
            }

            // Amount of change
            float percChangeAmt = this.AnimaPercent - old;

            this.CurrentAnimaPercentChangeRate += percChangeAmt;

            if (!quiet)
            {
                // Display afflict amount
                if (Math.Abs(percentLost) >= 0.1f)
                {
                    string fmtAmt = (int)(percChangeAmt * 100f) + "%";
                    Color  color;

                    if (percChangeAmt > 0f)
                    {
                        fmtAmt = "+" + fmtAmt;
                        color  = Color.Lerp(Color.Gold, Color.White, 0.25f);
                    }
                    else
                    {
                        color = Color.Lerp(Color.Gold, Color.Black, 0.25f);
                    }

                    CombatText.NewText(this.player.getRect(), color, fmtAmt);
                }
            }

            if (sync)
            {
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    PlayerAnimaSyncProtocol.Broadcast(this);
                }
                else if (Main.netMode == NetmodeID.Server)
                {
                    PlayerAnimaSyncProtocol.SendToAllClients(this);
                }
            }
        }