Пример #1
0
        public static void OnMonsterHit(IMonster monster, Pipliz.Box <float> box)
        {
            var ps = PlayerState.GetPlayerState(monster.OriginalGoal);

            box.Set(box.item1 - (box.item1 * ps.Difficulty.MonsterDamageReduction));
            ServerManager.SendAudio(monster.Position, GameLoader.NAMESPACE + "ZombieAudio");
        }
Пример #2
0
 public static void OnPlayerHit(Players.Player player, Pipliz.Box <float> box)
 {
     if (box.item1 > 0)
     {
         var state = PlayerState.GetPlayerState(player);
         box.Set(box.item1 + state.Difficulty.MonsterDamage);
     }
 }
Пример #3
0
        private static void DeductArmor(Pipliz.Box <float> box, Dictionary <ArmorSlot, SettlerInventory.ArmorState> entityArmor, Players.Player player, string name)
        {
            if (box.item1 > 0)
            {
                float armor = 0;

                foreach (ArmorSlot armorSlot in ArmorSlotEnum)
                {
                    if (!entityArmor.ContainsKey(armorSlot))
                    {
                        entityArmor.Add(armorSlot, new SettlerInventory.ArmorState());
                    }

                    if (!entityArmor[armorSlot].IsEmpty())
                    {
                        armor += ArmorLookup[entityArmor[armorSlot].Id].ArmorRating;
                    }
                }

                if (armor != 0)
                {
                    box.Set(box.item1 - (box.item1 * armor));

                    var hitLocation = _rand.Next(1, 100);

                    var dic = _hitChance;

                    if (!entityArmor[ArmorSlot.Shield].IsEmpty())
                    {
                        dic = _hitChanceShield;
                    }

                    foreach (var loc in dic)
                    {
                        if (!entityArmor[loc.Key].IsEmpty() && loc.Value >= hitLocation)
                        {
                            entityArmor[loc.Key].Durability--;

                            if (entityArmor[loc.Key].Durability <= 0)
                            {
                                entityArmor[loc.Key].Durability = 0;
                                entityArmor[loc.Key].Id         = default(ushort);
                                PandaChat.Send(player, $"{name} {loc.Key} broke! If you have a spare one it will be automatically equipt within 30 seconds.", ChatColor.white);
                            }

                            break;
                        }
                    }
                }
            }
        }
Пример #4
0
        public static void OnNPCHit(NPC.NPCBase npc, Pipliz.Box <float> box)
        {
            var state = PlayerState.GetPlayerState(npc.Colony.Owner);

            box.Set(box.item1 + state.Difficulty.MonsterDamage);
        }