// Addition 603
 public static void ADDITION_CANNOTMOVE(ref AdditionValue aval, int value)
 {
     Actor character = aval.sender as Actor;
     if (aval.context == AdditionContext.Applied && value == 0)
         character._status.CannotMove += 1;
     else if (aval.context == AdditionContext.Deapplied)
         character._status.CannotMove -= 1;
 }
 public static void ADDITION_BLOCKRATE(ref AdditionValue aval, int value)
 {
     Actor character = (Actor)aval.sender;
     if (aval.context == AdditionContext.Applied)
         character.Status.BlockratePhysical += (ushort)value;
     else if (aval.context == AdditionContext.Deapplied)
         character.Status.BlockratePhysical -= (ushort)value;
 }
 public static void ActDead(ref AdditionValue aval, int value)
 {
     Actor starget = aval.sender as Actor;
     if (starget != null)
     {
         //DO SOMETHING
         Console.WriteLine("Act dead");
     }
 }
 // Addition 611
 public static void ADDITION_CANSEERESSHOLD(ref AdditionValue aval, int value)
 {
     Actor starget = aval.sender as Actor;
     if (starget != null)
     {
         if (aval.context == AdditionContext.Applied)
             starget._status.ChaseTresshold += (byte)(value ^ 1);
         else if (aval.context == AdditionContext.Deapplied)
             starget._status.ChaseTresshold -= (byte)(value ^ 1);
     }
 }
 public static void ADDITION_BREATH(ref AdditionValue aval, int value)
 {
     Actor character = aval.target as Actor;
     if ((aval.context == AdditionContext.Applied || aval.context == AdditionContext.Reapplied) && character != null)
     {
         character._status.CurrentOxygen += (byte)value;
         character._status.Updates |= 1;
         if (character._status.CurrentOxygen > character._status.MaximumOxygen)
         {
             character._status.CurrentOxygen = character._status.MaximumOxygen;
         }
     }
 }
        public static void ADDITION_CON(ref AdditionValue aval, int value)
        {
            Character character = (Character)aval.sender;

            if (aval.context == AdditionContext.Applied)
            {
                character._status.MaxRAttack += (ushort)(4 * value);
                character._status.MinRAttack += (ushort)(2 * value);
                character._status.BasePHitrate += (ushort)(2 * value);
                character.stats.EQUIPMENT.concentration += (byte)value;
            }
            else if (aval.context == AdditionContext.Deapplied)
            {
                character._status.MaxRAttack -= (ushort)(4 * value);
                character._status.MinRAttack -= (ushort)(2 * value);
                character._status.BasePHitrate -= (ushort)(2 * value);
                character.stats.EQUIPMENT.concentration -= (byte)value;
            }
        }
        public static void RandomizeItem(ref AdditionValue aval, int value)
        {
            if (aval.context == AdditionContext.Applied)
            {
                Character character = (Character)aval.sender;
                List<uint> Itemlist = new List<uint>();
                switch (value)
                {
                    case 1:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 2:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 3:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 4:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 5:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 6:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 7:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 8:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 9:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 10:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 11:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 12:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 13:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 14:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 15:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 16:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 17:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 18: Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;

                    case 19:
                        Itemlist.Clear();
                        Itemlist.Add(100000);
                        Itemlist.Add(100001);
                        Itemlist.Add(100002);
                        Itemlist.Add(100003);
                        break;
                }

                if (Itemlist.Count == 0) return;
                int rand = Singleton.WorldTasks.random.Next(0, 100) % Itemlist.Count;
                Common.Items.GiveItem(character, Itemlist[rand], 1);
            }
        }
 //524        | P. Short Attack           			    | True                 | True
 //525        | P. Ranged Attack                		    | True                 | True
 //526        | Magic Attack           			        | True                 | True
 public static void PATTACK(ref AdditionValue aval, int value)
 {
     //Memory subfunction
     //Addition 500 - Min. P. Short Attack;
     Actor character = aval.sender as Actor;
     BattleStatus status = character.Status;
     if (aval.context == AdditionContext.Applied)
     {
         status.MinPAttack += value;
         status.MaxPAttack += value;
     }
     else if (aval.context == AdditionContext.Deapplied)
     {
         status.MinPAttack -= value;
         status.MaxPAttack -= value;
     }
 }
        /// <summary>
        /// Adds the specified value of ice-resistance to the specified aval.sender
        /// </summary>
        /// <param name="aval.sender"></param>
        /// <param name="Value"></param>
        /// <param name="aval.context"></param>
        public static void IceResistance(ref AdditionValue aval, int value)
        {
            //CHARACTER TO INVOKE
            Actor targeta = aval.sender as Actor;
            targeta._status.Updates |= 2;

            lock (targeta._status)
            {
                //CHECKS IF WE ARE aval.contextING OR DEaval.contextING
                if (aval.context == AdditionContext.Applied)
                    targeta._status.IceResistance += (ushort)value;
                else if (aval.context == AdditionContext.Deapplied)
                    targeta._status.IceResistance -= (ushort)value;
            }
        }
 public static void BLOCKSPRECOVERY(ref AdditionValue aval, int value)
 {
     Character starget = aval.sender as Character;
     if (starget != null)
     {
         if (aval.context == AdditionContext.Applied)
             starget.blocksprecovery += (byte)(value ^ 1);
         else if (aval.context == AdditionContext.Deapplied)
             starget.blockhprecovery -= (byte)(value ^ 1);
     }
 }
        public static void ADDITION_LP(ref AdditionValue aval, int value)
        {
            Actor character = aval.target as Actor;
            if ((aval.context == AdditionContext.Applied || aval.context == AdditionContext.Reapplied) && character != null)
            {
                character._status.CurrentLp += (byte)value;
                character._status.Updates |= 1;
                if (character._status.CurrentLp > 7)
                {
                    character._status.CurrentLp = 7;
                }

                //Do lp effect
                if (value > 0)
                    Common.Skills.SendSkillEffect(character, aval.additionid, 3, (uint)value);
            }
        }
        public static void ADDITION_INT(ref AdditionValue aval, int value)
        {
            Character character = (Character)aval.sender;

            if (aval.context == AdditionContext.Applied)
            {
                character._status.MaxMAttack += (ushort)(6 * value);
                character._status.MinMAttack += (ushort)(3 * value);
                character._status.BasePHitrate += (ushort)(1 * value);
                character.stats.EQUIPMENT.intelligence += (byte)value;
            }
            else if (aval.context == AdditionContext.Deapplied)
            {
                character._status.MaxMAttack -= (ushort)(6 * value);
                character._status.MinMAttack -= (ushort)(3 * value);
                character._status.BaseRHitrate -= (ushort)(1 * value);
                character.stats.EQUIPMENT.intelligence -= (byte)value;
            }
        }
 //Addition 586
 public static void ADDITION_DROPRATE(ref AdditionValue aval, int value)
 {
 }
        public static void ADDITION_DEX(ref AdditionValue aval, int value)
        {
            Character character = (Character)aval.sender;

            if (aval.context == AdditionContext.Applied)
            {
                character._status.BasePHitrate += (ushort)(1 * value);
                character.stats.EQUIPMENT.dexterity += (byte)value;
            }
            else if (aval.context == AdditionContext.Deapplied)
            {
                character._status.BasePHitrate -= (ushort)(1 * value);
                character.stats.EQUIPMENT.dexterity -= (byte)value;
            }
        }
        // Addition 665
        public static void ADDITION_CURRENTSPTARGET(ref AdditionValue aval, int value)
        {
            Actor character = aval.target as Actor;
            if ((aval.context == AdditionContext.Applied || aval.context == AdditionContext.Reapplied) && character != null)
            {
                character._status.CurrentSp += (ushort)value;
                character._status.Updates |= 1;
                if (character._status.CurrentSp > (ushort)character._status.MaxSP)
                {
                    character._status.CurrentSp = (ushort)character._status.MaxSP;
                }

                Common.Skills.SendSkillEffect(character, aval.additionid, 2, (uint)value);
            }
        }
 public static void ADDITION_SPRECOVERYRATE(ref AdditionValue aval, int value)
 {
     Actor character = aval.sender as Actor;
     if (aval.context == AdditionContext.Applied)
         character._status.SpRecoveryRate += (ushort)value;
     else if (aval.context == AdditionContext.Deapplied)
         character._status.SpRecoveryRate -= (ushort)value;
 }
        //545        | Strength                           | True                 | False
        //546        | Dexterity                          | True                 | False
        //547        | Intellect                          | True                 | False
        //548        | Concentration                      | True                 | False
        //549        | Luck                               | True                 | False
        public static void ADDITION_STR(ref AdditionValue aval, int value)
        {
            Character character = (Character)aval.sender;

            if (aval.context == AdditionContext.Applied)
            {
                character._status.MaxPAttack += (ushort)(2 * value);
                character._status.MinPAttack += (ushort)(1 * value);
                character._status.MaxHP += (ushort)(10 * value);
                character.stats.EQUIPMENT.strength += (byte)value;
                character._status.Updates |= 1;
            }
            else if (aval.context == AdditionContext.Deapplied)
            {
                character._status.MaxPAttack -= (ushort)(2 * value);
                character._status.MinPAttack -= (ushort)(1 * value);
                character._status.MaxHP -= (ushort)(10 * value);
                character.stats.EQUIPMENT.strength -= (byte)value;
                character._status.Updates |= 1;
            }
        }
        public static void ADDITION_LUK(ref AdditionValue aval, int value)
        {
            Character character = (Character)aval.sender;

            if (aval.context == AdditionContext.Applied)
                character.stats.EQUIPMENT.luck += (byte)value;
            else if (aval.context == AdditionContext.Deapplied)
                character.stats.EQUIPMENT.luck -= (byte)value;
        }
 /// <summary>
 /// Casting Time
 /// </summary>
 /// <param name="aval.sender"></param>
 /// <param name="target"></param>
 /// <param name="value"></param>
 /// <param name="aval.context"></param>
 public static void CastTime(ref AdditionValue aval, int value)
 {
     Actor character = aval.target as Actor;
     BattleStatus status = character.Status;
     if (aval.context == AdditionContext.Applied)
         status.CastingTime += (ushort)value;
     else if (aval.context == AdditionContext.Deapplied)
         status.CastingTime -= (ushort)value;
 }
 public static void ADDITION_MBREATHCAPACITY(ref AdditionValue aval, int value)
 {
     Actor character = aval.target as Actor;
     if (aval.context == AdditionContext.Applied)
         character._status.MaximumOxygen += (byte)value;
     else if (aval.context == AdditionContext.Deapplied)
         character._status.MaximumOxygen -= (byte)value;
     character._status.Updates |= 1;
 }
 public static void MEVASIONRATE(ref AdditionValue aval, int value)
 {
     //Memory subfunction
     //Addition 535 -  Magic Evasionrate  ;
     Actor character = aval.sender as Actor;
     BattleStatus status = character.Status;
     if (aval.context == AdditionContext.Applied)
         status.BaseMEvasionrate += value;
     else if (aval.context == AdditionContext.Deapplied)
         status.BaseMEvasionrate -= value;
 }
        public static void ADDITION_MSP(ref AdditionValue aval, int value)
        {
            //Memory subfunction
            //Addition 533 -  P. Short Hitrate ;

            Actor character = aval.target as Actor;
            BattleStatus status = character.Status;
            if (aval.context == AdditionContext.Applied)
                status.MaxSP += value;
            else if (aval.context == AdditionContext.Deapplied)
                status.MaxSP -= value;
            character._status.Updates |= 1;
        }
        public static void MINRATTACK(ref AdditionValue aval, int value)
        {
            //Memory subfunction
            //Addition 501 - Min. P. R. Attack;

            Actor character = aval.sender as Actor;
            BattleStatus status = character.Status;
            if (aval.context == AdditionContext.Applied)
                status.MinRAttack += value;
            else if (aval.context == AdditionContext.Deapplied)
                status.MinRAttack -= value;
        }
 //579        | P. Defence                               | True                 | True
 //580        | Magic Defence                            | True                 | False
 public static void ADDITION_PHYSICALDEFENSE(ref AdditionValue aval, int value)
 {
     Actor character = aval.sender as Actor;
     if (aval.context == AdditionContext.Applied)
         character._status.DefencePhysical += (byte)value;
     else if (aval.context == AdditionContext.Deapplied)
         character._status.DefencePhysical -= (byte)value;
 }
        public static void MINWRATTACK(ref AdditionValue aval, int value)
        {
            //Memory subfunction
            //Addition 519 - Min. Ranged Weapon Damage;

            Actor character = aval.sender as Actor;
            BattleStatus status = character.Status;
            if (aval.context == AdditionContext.Applied)
                status.MinWRAttack += (ushort)value;
            else if (aval.context == AdditionContext.Deapplied)
                status.MinWRAttack -= (ushort)value;
        }
 public static void ADDITION_SP(ref AdditionValue aval, int value)
 {
     Actor character = aval.target as Actor;
     if ((aval.context == AdditionContext.Applied || aval.context == AdditionContext.Reapplied) && character != null)
     {
         character._status.CurrentSp += (ushort)value;
         character._status.Updates |= 1;
         if (character._status.CurrentSp > (ushort)character._status.MaxSP)
         {
             character._status.CurrentSp = (ushort)character._status.MaxSP;
         }
     }
 }
 //533        | P. Short Hitrate        			        | True                 | True
 //534        | P. Ranged Hitrate          			    | True                 | True
 //535        | Magic Hitrate          			        | True                 | True
 public static void PHITRATE(ref AdditionValue aval, int value)
 {
     //Memory subfunction
     //Addition 533 -  P. Short Hitrate ;
     Actor character = aval.sender as Actor;
     BattleStatus status = character.Status;
     if (aval.context == AdditionContext.Applied)
         status.BasePHitrate += value;
     else if (aval.context == AdditionContext.Deapplied)
         status.BasePHitrate -= value;
 }
 public static void ADDITION_SPRECOVERQUANTITY(ref AdditionValue aval, int value)
 {
     Actor character = aval.sender as Actor;
     if (aval.context == AdditionContext.Applied)
         character._status.SpRecoveryQuantity += (short)value;
     else if (aval.context == AdditionContext.Deapplied)
         character._status.SpRecoveryQuantity -= (short)value;
 }
        // Addition 613
        public static void ADDITION_CEXP(ref AdditionValue aval, int value)
        {
            Character character = aval.sender as Character;

            if (value <= -20000)
            {
                double valueb = ((double)(value + 20000) / (double)1000);
                if (aval.context == AdditionContext.Applied)
                    character._CexpModifier += valueb;
                else if (aval.context == AdditionContext.Deapplied)
                    character._CexpModifier -= valueb;
            }
            else if (value >= 20000)
            {
                double valueb = ((double)(value - 20000) / (double)1000);
                if (aval.context == AdditionContext.Applied)
                    character._CexpModifier += valueb;
                else if (aval.context == AdditionContext.Deapplied)
                    character._CexpModifier -= valueb;
            }
        }
 // Addition 670
 public static void ADDITION_CHATBAN(ref AdditionValue aval, int value)
 {
     Character starget = aval.sender as Character;
     if (starget != null)
     {
         if (aval.context == AdditionContext.Applied)
             starget.chatmute += (byte)(value ^ 1);
         else if (aval.context == AdditionContext.Deapplied)
             starget.chatmute -= (byte)(value ^ 1);
     }
 }