Exemple #1
0
        private void SelfHarm(HungerGameProfile profile)
        {
            if (!profile.Alive)
            {
                return;
            }
            int dmg;

            if (profile.Hunger >= 90 || profile.Tiredness >= 100)
            {
                dmg = _random.Next(20, 30);
            }
            else if (profile.Hunger >= 80 || profile.Tiredness >= 90)
            {
                dmg = _random.Next(5, 10);
            }
            else
            {
                return;
            }
            if (profile.Health - dmg <= 0)
            {
                profile.Alive  = false;
                profile.Health = 0;
            }
            else
            {
                profile.Health = profile.Health - dmg;
            }
        }
Exemple #2
0
 private void Fatigue(HungerGameProfile profile)
 {
     if (!profile.Alive)
     {
         return;
     }
     profile.Hunger    = profile.Hunger + _random.Next(5, 10);
     profile.Tiredness = profile.Tiredness + _random.Next(20, 30);
 }
Exemple #3
0
        internal UserAction HackEvent(HungerGameProfile profile, ItemDrop items, UserAction activity)
        {
            foreach (var x in items.Weapons)
            {
                var weaponCheck = profile.Inventory.Weapons.FirstOrDefault(y => y.Weapon == x);
                if (weaponCheck == null)
                {
                    profile.Inventory.Weapons.Add(new WeaponInventory {
                        Amount = 1, Weapon = x
                    });
                }
                else
                {
                    weaponCheck.Amount += 1;
                }
            }

            foreach (var x in items.FirstAids)
            {
                var firstAidCheck = profile.Inventory.FirstAid.FirstOrDefault(y => y.FirstAid == x);
                if (firstAidCheck == null)
                {
                    profile.Inventory.FirstAid.Add(new FirstAidInventory {
                        Amount = 1, FirstAid = x
                    });
                }
                else
                {
                    firstAidCheck.Amount += 1;
                }
            }

            foreach (var x in items.Drinks)
            {
                var drinkCheck = profile.Inventory.Drinks.FirstOrDefault(y => y.Drink == x);
                if (drinkCheck == null)
                {
                    profile.Inventory.Drinks.Add(new DrinkInventory {
                        Amount = 1, Drink = x
                    });
                }
                else
                {
                    drinkCheck.Amount += 1;
                }
            }

            foreach (var x in items.Foods)
            {
                var foodCheck = profile.Inventory.Food.FirstOrDefault(y => y.Food == x);
                if (foodCheck == null)
                {
                    profile.Inventory.Food.Add(new FoodInventory {
                        Amount = 1, Food = x
                    });
                }
                else
                {
                    foodCheck.Amount += 1;
                }
            }

            activity.Reward = items;
            return(activity);
        }
        private UserAction EventManager(ActionType type, List <HungerGameProfile> users, HungerGameProfile profile,
                                        ItemDrop drops, UserAction activity)
        {
            switch (type)
            {
            case ActionType.Loot:
            {
                return(_loot.LootEvent(profile, drops, activity));
            }

            case ActionType.Attack:
            {
                activity.Action = ActionType.Attack;
                return(_attack.AttackEvent(users, profile, activity));
            }

            case ActionType.Idle:
            {
                activity.Action = ActionType.Idle;
                return(activity);
            }

            case ActionType.Meet:
            {
                activity.Action = ActionType.Meet;
                return(activity);
            }

            case ActionType.Hack:
            {
                activity.Action = ActionType.Hack;
                return(_hack.HackEvent(profile, drops, activity));
            }

            case ActionType.Die:
            {
                activity.Action = ActionType.Die;
                _die.DieEvent(profile);
                return(activity);
            }

            case ActionType.Sleep:
            {
                activity.Action = ActionType.Sleep;
                _sleep.SleepEvent(profile);
                return(activity);
            }

            case ActionType.Eat:
            {
                activity.Action = ActionType.Eat;
                _eat.EatEvent(profile);
                return(activity);
            }

            default:
                activity.Action = ActionType.Idle;
                return(activity);
            }
        }
 internal void DetermineEvent(ActionType type, List <HungerGameProfile> users, HungerGameProfile profile,
                              ItemDrop drops, UserAction activity) =>
 EventManager(type, users, profile, drops, activity);
 internal void DetermineEvent(List <HungerGameProfile> users, HungerGameProfile profile, ItemDrop drops, UserAction activity) =>
 EventManager(_chance.EventDetermination(profile), users, profile, drops, activity);
Exemple #7
0
 internal void SleepEvent(HungerGameProfile profile)
 {
     profile.Tiredness = 0;
     profile.Stamina   = 100;
 }