public void HitBy(NPC npc, Projectile projectile, int dmg) { int totalDmg; if (!NPChitters.TryGetValue(npc, out totalDmg)) totalDmg = 0; totalDmg += dmg; NPChitters[npc] = totalDmg; LastProjectile = projectile; LastHitterNPC = npc; LastHitterChar = npc as Character; }
static void ActivateHealHp(NPC npc, int amount, List<Packet> pkts) { int maxHp = npc.ObjectDesc.MaxHP; int newHp = Math.Min(maxHp, npc.HP + amount); if (newHp != npc.HP) { pkts.Add(new ShowEffectPacket() { EffectType = EffectType.Potion, TargetId = npc.Id, Color = new ARGB(0xffffffff) }); pkts.Add(new NotificationPacket() { Color = new ARGB(0xff00ff00), ObjectId = npc.Id, Text = "+" + (newHp - npc.HP) }); npc.HP = newHp; npc.UpdateCount++; } }