public CivilianProfile CloneNPC(CivilianProfile NPC) { CivilianProfile NewNPC = new CivilianProfile(); NewNPC.name = NPC.name; NewNPC.TalkToResponse = NPC.TalkToResponse; NewNPC.inventory = new List <itemInfo>(); if (NPC.inventory != null) { foreach (itemInfo item in NPC.inventory) { NewNPC.inventory.Add(CloneItem(item)); } } NewNPC.Knowledge = new List <Facts>(); if (NPC.Knowledge != null) { foreach (Facts fact in NPC.Knowledge) { NewNPC.Knowledge.Add(CloneFact(fact)); } } NewNPC.HPBonus = NPC.HPBonus; NewNPC.armor = NPC.armor; NewNPC.Money = NPC.Money; NewNPC.willSell = NPC.willSell; NewNPC.willBuy = NPC.willBuy; NewNPC.MerchantType = NPC.MerchantType; NewNPC.QuestCharacter = NPC.QuestCharacter; NewNPC.XP = NPC.XP; NewNPC.Donation = NPC.Donation; //NewNPC.ImagePath = NPC.ImagePath; //NewNPC.ImageLocation = NPC.ImageLocation; return(NewNPC); }
public static void PayOff(string EnemyName, int amount) { int index = 0; bool enemyfound = false; //LoDConsole.WriteLine("!! Trying to pay off {0} with amount {1} !!\n", EnemyName, amount); while (CurrentRoom.Enemy != null && index < CurrentRoom.Enemy.Count) { if (EnemyName.ToLower() == CurrentRoom.Enemy[index].name.ToLower()) { enemyfound = true; if (CurrentRoom.Enemy[index].PayOff == 0) { LoDConsole.WriteLine(WordWrap(string.Concat(EnemyName, " will not accept a bribe from you\n"))); attacked(); } else if (amount >= CurrentRoom.Enemy[index].PayOff) //enemy will accept more than the bribe amount { LoDConsole.WriteLine(WordWrap(string.Concat(EnemyName, " has accepted your bribe. \"", CurrentRoom.Enemy[index].PayOffResponse, "\" says your opponent as they holster their weapon and stand down"))); if (CurrentRoom.Civilians == null) CurrentRoom.Civilians = new List<CivilianProfile>(); CivilianProfile notHostile = new CivilianProfile(); //convert enemy to non hostile civilian notHostile.name = CurrentRoom.Enemy[index].name; notHostile.TalkToResponse = CurrentRoom.Enemy[index].PayOffResponse; notHostile.inventory = new List<itemInfo>(); notHostile.inventory.Add(CurrentRoom.Enemy[index].Weapon); notHostile.HPBonus = CurrentRoom.Enemy[index].HPBonus; notHostile.armor = CurrentRoom.Enemy[index].armor; notHostile.willSell = false; notHostile.Money = CurrentRoom.Enemy[index].Money + amount; notHostile.QuestCharacter = false; notHostile.XP = 0; CurrentRoom.Civilians.Add(notHostile); SaveWorld(); Player.Money = Player.Money - amount; CurrentRoom.Enemy[index] = GainXPfromEnemy(CurrentRoom.Enemy[index]); EventTrigger("payoff", CurrentRoom.Enemy[index].name); CurrentRoom.Enemy.RemoveAt(index); } else { LoDConsole.WriteLine(WordWrap(string.Concat("Enemy ", CurrentRoom.Enemy[index].name, " examines the coins and decides you haven't given them enough. They attack in response.\n"))); Player.Money = Player.Money - amount; EnemyProfile Enemy = CurrentRoom.Enemy[index]; Enemy.Money = Enemy.Money + amount; Enemy.PayOff = 0; CurrentRoom.Enemy[index] = Enemy; attacked(); } } index++; } if (enemyfound == false) { LoDConsole.WriteLine(WordWrap(string.Concat(EnemyName, " was not found in the current area"))); } }
public CivilianProfile CloneNPC(CivilianProfile NPC) { CivilianProfile NewNPC = new CivilianProfile(); NewNPC.name = NPC.name; NewNPC.TalkToResponse = NPC.TalkToResponse; NewNPC.inventory = new List<itemInfo>(); if (NPC.inventory != null) foreach (itemInfo item in NPC.inventory) { NewNPC.inventory.Add(CloneItem(item)); } NewNPC.Knowledge = new List<Facts>(); if (NPC.Knowledge != null) foreach (Facts fact in NPC.Knowledge) { NewNPC.Knowledge.Add(CloneFact(fact)); } NewNPC.HPBonus = NPC.HPBonus; NewNPC.armor = NPC.armor; NewNPC.Money = NPC.Money; NewNPC.willSell = NPC.willSell; NewNPC.willBuy = NPC.willBuy; NewNPC.MerchantType = NPC.MerchantType; NewNPC.QuestCharacter = NPC.QuestCharacter; NewNPC.XP = NPC.XP; NewNPC.Donation = NPC.Donation; //NewNPC.ImagePath = NPC.ImagePath; //NewNPC.ImageLocation = NPC.ImageLocation; return NewNPC; }
public static CivilianProfile GainXPfromNPC(CivilianProfile NPC) { if (NPC.XP > 0) Player.XP = Player.XP + NPC.XP; NPC.XP = 0; return NPC; }