本文整理汇总了C#中ICharacter.MapDropItem方法的典型用法代码示例。如果您正苦于以下问题:C# ICharacter.MapDropItem方法的具体用法?C# ICharacter.MapDropItem怎么用?C# ICharacter.MapDropItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICharacter
的用法示例。
在下文中一共展示了ICharacter.MapDropItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DamageCharacter
private static void DamageCharacter(ICharacter character, IMap map, int dmg, Enums.KillType killType, PacketHitList hitlist, bool checkDeath)
{
int point = 0;
try {
character.HP -= dmg;
if (dmg <= 0) {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " took no damage!", Text.BrightRed), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took no damage!", Text.BrightRed);
} else {
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " took " + dmg + " damage!", Text.BrightRed), character.X, character.Y, 10);
//BothWaysBattleMsg(setup, setup.Defender.Name + " took " + damage + " damage!", Text.BrightRed);
}
point = 1;
if (checkDeath && character.HP <= 0) {
if (character.CharacterType == Enums.CharacterType.Recruit) {
point = 2;
hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Oh, no! " + character.Name + " fainted!", Text.BrightRed));
point = 3;
OnDeath(((Recruit)character).Owner, Enums.KillType.Other);
point = 4;
} else {
if (character.HeldItem != null) {
character.MapDropItem(character.HeldItem.Amount, null);
}
OnNpcDeath(hitlist, null, (MapNpc)character);
//((MapNpc)character).Num = 0;
//((MapNpc)character).HP = 0;
map.ActiveNpc[((MapNpc)character).MapSlot] = new MapNpc(character.MapID, ((MapNpc)character).MapSlot);
hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", ((MapNpc)character).MapSlot));
}
}
} catch(Exception ex) {
Messenger.AdminMsg("Error: DamageCharacter", Text.Black);
Messenger.AdminMsg(ex.ToString(), Text.Black);
Messenger.AdminMsg(character.Name + " took " + dmg + " dmg at " + map.Name + " from " + killType + " with checkDeath=" + checkDeath + " and point=" + point, Text.Black);
throw new Exception();
}
}