/// <summary>
 ///     Fires the MonsterKilled event if the removed NPC is a monster and has 0 or less health
 ///     or its a grub that doesn't have a fixed health value of -500 for when it transforms into a fly
 /// </summary>
 /// <param name="value"></param>
 private void Characters_OnValueRemoved(NPC value)
 {
     // Grub at -500 health means it transformed
     // This is a hacky way to detect transformation, but the alternative is reflection
     if (value is Monster monster && monster.Health <= 0 && (!(value is Grub grub) || grub.Health != -500))
     {
         MonsterKilled.Invoke(Game1.currentLocation, monster);
     }
 }
 /// <summary>
 ///     Fires the MonsterKilled event if the removed NPC is a monster and has 0 or less health
 ///     or its a grub that doesn't have a fixed health value of -500 for when it transforms into a fly
 /// </summary>
 /// <param name="value"></param>
 private void Characters_OnValueRemoved(NPC value)
 {
     // Grub at -500 health means it transformed
     // This is a hacky way to detect transformation, but the alternative is reflection
     if (value is Monster monster)
     {
         if (monster.Health <= 0 ||
             ((value is Grub grub) && grub.Health != -500) ||
             (monster.Name == Monsters.Mummy && monster.Health == monster.MaxHealth))
         {
             MonsterKilled.Invoke(Game1.currentLocation, monster);
         }
     }
 }
Example #3
0
 public void OnMonsterKilled()
 {
     Bot.Stats.Kills++;
     MonsterKilled?.Invoke(Bot);
 }
Example #4
0
 public void OnMonsterKilled()
 {
     MonsterKilled?.Invoke(Bot);
 }