Пример #1
0
        public static int CalculateDamage(GameClient Session, GameClient TargetSession)
        {
            int    Damage           = 0;
            string WeaponName       = "";
            double WeaponLevelKills = Session.GetRoleplay().MeleeKills / 250;
            int    WeaponLevel      = (int)Math.Round(WeaponLevelKills, 0);
            int    WeaponDamage     = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Max_Damage;

            foreach (KeyValuePair <string, Weapon> Weapon in Session.GetRoleplay().Weapons)
            {
                string WeaponData = Weapon.Key;
                WeaponName = WeaponManager.GetWeaponName(WeaponData);
            }

            int Damage2 = new Random().Next(WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Min_Damage, WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Max_Damage);

            Damage = new Random().Next((Session.GetRoleplay().Strength + Session.GetRoleplay().savedSTR), Damage2 + WeaponLevel * 3);
            return(Damage);
        }
Пример #2
0
        public static void HandleGun(GameClient Session, GameClient TargetSession, Room Room, RoomUser RoomUser, RoomUser Target, string WeaponName, int Damage)
        {
            // string WeaponName =
            switch (WeaponName)
            {
            case "freezeray":

                #region Freeze Ray

                Session.GetRoleplay().FreezeRay.HandleGeneralAttack(TargetSession);

                #endregion

                break;



            default:

                #region Normal Weapons
                if (TargetSession == null)
                {
                    return;
                }

                RoomUser.LastBubble = 3;
                Target.LastBubble   = 3;

                if (Session.GetRoleplay().Equiped == null)
                {
                    return;
                }

                if (!WeaponManager.isWeapon(Session.GetRoleplay().Equiped.ToLower()))
                {
                    return;
                }

                if (WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech == null || WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech == "")
                {
                    Session.Shout("*Shoots their " + WeaponName + " at " + TargetSession.GetHabbo().UserName + ", causing " + Damage + " damage [-" + WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy + " Energy]*");
                }
                else
                {
                    string finalspeech = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Speech.Replace("%energy%", Convert.ToString(WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Need_Energy)).Replace("%damage%", Convert.ToString(Damage)).Replace("%username%", TargetSession.GetHabbo().UserName);
                    Session.Shout(finalspeech);
                }

                if (TargetSession.GetRoleplay().Armor >= 1)
                {
                    TargetSession.commandShout("*[" + TargetSession.GetRoleplay().Armor + "AP Left!]*");
                }
                else
                {
                    TargetSession.commandShout("*[" + TargetSession.GetRoleplay().CurHealth + "/" + TargetSession.GetRoleplay().MaxHealth + "]*");
                }
                RoomUser.LastBubble = 0;
                Target.LastBubble   = 0;
                #endregion

                break;
            }
        }
Пример #3
0
        public static int DamageCalculator(GameClient Session, bool isWeapon = false)
        {
            int Damage = 0;
            int Bonus  = 0;
            int str    = 0;

            int fistDamage = 0;

            if (!isWeapon)
            {
                if (Session.GetRoleplay().inColourWars)
                {
                    str = new Random().Next(5, 13);
                }
                else
                {
                    str = Session.GetRoleplay().Strength + Session.GetRoleplay().UsingWeed_Bonus + Session.GetRoleplay().savedSTR;
                }

                int rndNum = new Random().Next(1, 15);

                if (rndNum == 1)
                {
                    fistDamage += (str + Bonus + 1) * 3;
                }

                else if (rndNum < 5)
                {
                    fistDamage += (str + Bonus + 1) * 2;
                }

                else if (rndNum < 10)
                {
                    fistDamage += str + Bonus + 3;
                }

                else
                {
                    fistDamage += str + Bonus + 1;
                }

                Damage = new Random().Next(Session.GetRoleplay().Strength + Session.GetRoleplay().savedSTR, fistDamage);
            }
            else
            {
                string WeaponName       = "";
                double WeaponLevelKills = Session.GetRoleplay().GunKills / 500;
                int    WeaponLevel      = (int)Math.Round(WeaponLevelKills, 0);
                int    WeaponDamage     = WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Max_Damage;

                foreach (KeyValuePair <string, Weapon> Weapon in Session.GetRoleplay().Weapons)
                {
                    string WeaponData = Weapon.Key;
                    WeaponName = WeaponManager.GetWeaponName(WeaponData);
                }

                Damage = new Random().Next(WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Min_Damage, WeaponManager.WeaponsData[Session.GetRoleplay().Equiped].Max_Damage);
            }

            return(Damage);
        }