public string JoinParty(string[] args) { var characterType = args[0]; var name = args[1]; Character character = null; switch (characterType) { case "Warrior": character = new Warrior(name); break; case "Priest": character = new Priest(name); break; default: var msg = string.Format(ExceptionMessages.InvalidCharacterType, characterType); throw new ArgumentException(msg); } this.characters.Add(character); var outputMsg = string.Format(SuccessMessages.JoinParty, name); return(outputMsg); }
public string Heal(string[] args) { var healerName = args[0]; var healingReceiverName = args[1]; if (!party.Any(p => p.Name == healerName)) { throw new ArgumentException($"Character {healerName} not found!"); } if (!party.Any(p => p.Name == healingReceiverName)) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } var healer = party.FirstOrDefault(h => h.Name == healerName); var receiver = party.FirstOrDefault(r => r.Name == healingReceiverName); if (healer.GetType().Name != "Priest") { throw new ArgumentException($"{healer.Name} cannot heal!"); } Priest priest = (Priest)healer; priest.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; Character healer = party.FirstOrDefault(c => c.Name == healerName); Character receiver = party.FirstOrDefault(c => c.Name == healingReceiverName); if (healer == null) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healerName)); } if (receiver == null) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healingReceiverName)); } if (healer.AbilityPoints == 0) { throw new ArgumentException(string.Format(ExceptionMessages.HealerCannotHeal, healerName)); } Priest priest = (Priest)healer; priest.Heal(receiver); return(string.Format(SuccessMessages.HealCharacter, healer.Name, receiver.Name, healer.AbilityPoints, receiver.Name, receiver.Health)); }
public void PriestStatSet(Priest target, int indexNum) { target.MAXHEATH = PriestStatData["prieststat"][indexNum].MAXHEATH; target.HOLYPOWER = PriestStatData["prieststat"][indexNum].HOLYPOWER; target.MOVESPEED = PriestStatData["prieststat"][indexNum].MOVESPEED; target.INDEX = PriestStatData["prieststat"][indexNum].INDEX; }
public string Heal(string[] args) { string healerName = args[0]; string receiverName = args[1]; Priest priest = new Priest(healerName); if (party.Contains(priest)) { Character healReciever = party.Find(ch => ch.Name == receiverName); if (party.Contains(healReciever)) { if (priest.IsAlive && !healReciever.IsAlive) { return($"{healerName} cannot heal!"); } priest.Heal(healReciever); StringBuilder heal = new StringBuilder(); heal.Append($"{healerName} heals {receiverName} for {priest.AbilityPoints}! {healReciever.Name} has {healReciever.Health} health now!"); return(heal.ToString()); } else { throw new ArgumentException($"Character {receiverName} not found!"); } } else { throw new ArgumentException($"Character {healerName} not found!"); } }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; if (!this.characterParty.Any(x => x.Name == healerName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healerName)); } if (!this.characterParty.Any(x => x.Name == healingReceiverName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healingReceiverName)); } var character = this.characterParty.FirstOrDefault(x => x.Name == healerName); if (character.GetType().Name != nameof(Priest)) { throw new ArgumentException(string.Format(ExceptionMessages.HealerCannotHeal, healerName)); } Priest healer = (Priest)character; var receiver = this.characterParty.FirstOrDefault(x => x.Name == healingReceiverName); healer.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}!" + $" {receiver.Name} has {receiver.Health} health now!"); }
public Spells(Priest newPriestSpells) { this.priestSpells = newPriestSpells; if (priestSpells.Equals(Priest.Heal)) { this.spellName = "Heal"; this.spellValue = 100; this.spellClass = new Classes(Classes.Class.Priest); this.kindOfSpell = KindOfSpell.Heal; this.mana = 30; } if (priestSpells.Equals(Priest.Smite)) { this.spellName = "Smite"; this.spellValue = 245; this.spellClass = new Classes(Classes.Class.Priest); this.kindOfSpell = KindOfSpell.Damage; this.mana = 50; } if (priestSpells.Equals(Priest.MindControl)) { this.spellName = "Mind control"; this.spellValue = 490; this.spellClass = new Classes(Classes.Class.Priest); this.kindOfSpell = KindOfSpell.Damage; this.mana = 80; } }
public string Heal(string[] args) { string healerName = args[0]; string receiverName = args[1]; Priest healing = (Priest)characters.FirstOrDefault(n => n.Name == healerName); Character receiving = characters.FirstOrDefault(n => n.Name == receiverName); if (healing == null) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty), healerName); } if (receiving == null) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty), receiverName); } if (healing.GetType().Name == nameof(Warrior)) { throw new ArgumentException(string.Format(ExceptionMessages.AttackFail), healerName); } healing.Heal(receiving); StringBuilder sb = new StringBuilder(); sb.AppendLine($"{healing.Name} heals {receiving.Name} for {healing.AbilityPoints}! {receiving.Name} has {receiving.Health} health now!"); return(sb.ToString().TrimEnd()); }
public string JoinParty(string[] args) { Character character = null; string wariorOrPriest = args[0]; string name = args[1]; if (wariorOrPriest == "Warrior") { character = new Warrior(name); } else if (wariorOrPriest == "Priest") { character = new Priest(name); } else if (character == null) { throw new ArgumentException(string.Format(ExceptionMessages.InvalidCharacterType, wariorOrPriest)); } else { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNameInvalid)); } this.characters.Add(character); return(string.Format(SuccessMessages.JoinParty, name)); }
public string JoinParty(string[] args) { string characterType = args[0]; string name = args[1]; if (characterType != nameof(Warrior) && characterType != nameof(Priest)) { throw new ArgumentException(string.Format(ExceptionMessages.InvalidCharacterType, characterType)); } Character character = null; if (characterType == nameof(Warrior)) { character = new Warrior(name); } else if (characterType == nameof(Priest)) { character = new Priest(name); } this.characterParty.Add(character.Name, character); return(string.Format(SuccessMessages.JoinParty, name)); }
public string Heal(string[] args) { //healerName – args[0] //healingReceiverName – args[1] if (characters.Any(x => x.Name == args[0]) == false) { throw new ArgumentException($"Character {args[0]} not found!"); } if (characters.Any(x => x.Name == args[1]) == false) { throw new ArgumentException($"Character {args[1]} not found!"); } if (characters.FirstOrDefault(n => n.Name == args[0]).GetType().Name != "Priest") { throw new ArgumentException($"{args[0]} cannot heal!"); } Priest healer = (Priest)characters.FirstOrDefault(x => x.Name == args[0]); Character receiver = characters.FirstOrDefault(x => x.Name == args[1]); if (healer.IsAlive == false) { throw new ArgumentException($"{args[0]} cannot heal!"); } healer.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); }
public void SetActive(Priest target) { if (SkillPriestActive != null) { SkillPriestActive(target); } }
public string Heal(string[] args) { StringBuilder sb = new StringBuilder(); string healerName = args[0]; string healingReceiverName = args[1]; if (!this.characterRepo.Any(x => x.Name == healerName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty), healerName); } if (!this.characterRepo.Any(x => x.Name == healingReceiverName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty), healingReceiverName); } if (this.characterRepo.FirstOrDefault(x => x.Name == healerName).GetType().Name != "Priest") { throw new ArgumentException(string.Format(ExceptionMessages.HealerCannotHeal, healerName)); } Priest healer = (Priest)this.characterRepo.FirstOrDefault(x => x.Name == healerName); Character reciever = this.characterRepo.FirstOrDefault(x => x.Name == healingReceiverName); healer.Heal(reciever); sb.AppendLine(String.Format (SuccessMessages.HealCharacter, healer.Name, reciever.Name, healer.AbilityPoints, reciever.Name, reciever.Health)); return(sb.ToString().TrimEnd()); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; if (!characters.Any(x => x.Name == healerName)) { throw new ArgumentException(ExceptionMessages.CharacterNotInParty, healerName); } if (!characters.Any(x => x.Name == healingReceiverName)) { throw new ArgumentException(ExceptionMessages.CharacterNotInParty, healingReceiverName); } Character healer = characters.FirstOrDefault(x => x.Name == healerName); Character receiver = characters.FirstOrDefault(x => x.Name == healingReceiverName); if (healer.GetType().Name != "Priest") { throw new ArgumentException($"{healer.Name} cannot heal!"); } Priest priest = (Priest)healer; priest.Heal(receiver); return(string.Format(SuccessMessages.HealCharacter, healer.Name, receiver.Name, healer.AbilityPoints, receiver.Name)); }
private Priest SetFilePath(Priest priest, IEnumerable <HttpPostedFileBase> files) { if (files.Count() > 0) { int i = 0; foreach (var file in files) { if (i == 0) { if (file != null) { priest.Photo = "/Images/Priests/" + file.FileName; } else { if (priest.Photo == string.Empty || priest.Photo == null) { priest.Photo = "/Images/Priests/no_photo.jpg"; } } } i = i + 1; } } return(priest); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; if (this.characterParty.Any(x => x.Name == healerName) == false) { throw new ArgumentException($"Character {healerName} not found!"); } if (this.characterParty.Any(x => x.Name == healingReceiverName) == false) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } var healer = this.characterParty.FirstOrDefault(x => x.Name == healerName); var receiver = this.characterParty.FirstOrDefault(x => x.Name == healingReceiverName); if (healer.GetType().Name != "Priest") { throw new ArgumentException($"{healer.Name} cannot heal!"); } Priest priest = (Priest)healer; priest.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has received {receiver.Health} health now.!"); }
public string JoinParty(string[] args) { string characterType = args[0]; string name = args[1]; Character character = null; if (characterType == "Warrior") { character = new Warrior(name); } if (characterType == "Priest") { character = new Priest(name); } if (character == null) { throw new ArgumentException($"Invalid character type \"{characterType}\"!"); } characterParty.Add(character); return($"{name} joined the party!"); }
public string JoinParty(string[] args) { string name = args[1]; string type = args[0]; if (type != nameof(Warrior) && type != nameof(Priest)) { throw new ArgumentException($"Invalid character type \"{type}\"!"); } Character character = null; switch (type) { case nameof(Warrior): character = new Warrior(name); break; case nameof(Priest): character = new Priest(name); break; } this.party.Add(character); return($"{name} joined the party!"); }
// CreateHero type name public string CreateHero(List <string> args) { string type = args[0]; string heroName = args[1]; if (heroes.ContainsKey(heroName)) { return($"Hero with name: {heroName} already exists!"); } Hero hero = null; if (type == "Assassin") { hero = new Assassin(heroName); } else if (type == "Priest") { hero = new Priest(heroName); } else if (type == "Warrior") { hero = new Warrior(heroName); } if (hero == null) { return($"Invalid type hero: {type}."); } this.heroes.Add(heroName, hero); return($"{type}: {heroName} joined the Arena!"); }
public INPC GetNPC(NPCType type) { switch (type) { case NPCType.Beggar: INPC beggar = new Beggar(); return(beggar); case NPCType.Farmer: INPC farmer = new Farmer(); return(farmer); case NPCType.Shopowner: INPC shopowner = new Shopowner(); return(shopowner); case NPCType.Priest: INPC priest = new Priest(); return(priest); case NPCType.StrayDog: INPC strayDog = new StrayDog(); return(strayDog); case NPCType.Baker: INPC baker = new Baker(); return(baker); } return(null); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; Character healer = party.FirstOrDefault(x => x.Name == healerName); Character healingReceiver = party.FirstOrDefault(x => x.Name == healingReceiverName); if (healer == null) { throw new ArgumentException($"Character {healerName} not found!"); } if (healingReceiver == null) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } Priest priest = (Priest)healer; priest.Heal(healingReceiver); StringBuilder sb = new StringBuilder(); sb.AppendLine($"{healerName} heals {healingReceiverName} for {healer.AbilityPoints}! {healingReceiverName} has {healingReceiver.Health} health now!"); return(sb.ToString().TrimEnd()); }
public string JoinParty(string[] args) { string characterType = args[0]; string name = args[1]; Character character = null; if (characterType == "Warrior") { character = new Warrior(name); } else if (characterType == "Priest") { character = new Priest(name); } if (character == null) { throw new ArgumentException(ExceptionMessages.InvalidCharacterType, characterType); } characters.Add(character); return(string.Format(SuccessMessages.JoinParty, name)); }
public string Heal(string[] args) { string healerName = args[0]; string receiverName = args[1]; if (party.Any(x => x.Name == healerName) == false) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healerName)); } if (party.Any(x => x.Name == receiverName) == false) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, receiverName)); } Character healer = party.First(x => x.Name == healerName); Character receiver = party.First(x => x.Name == receiverName); if (healer.GetType().Name != nameof(Priest)) { throw new ArgumentException(string.Format(ExceptionMessages.HealerCannotHeal, healerName)); } Priest priest = (Priest)healer; priest.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); }
public string JoinParty(string[] args) { string heroType = args[0]; string heroName = args[1]; Character hero; //Type type = Assembly.GetCallingAssembly().GetTypes().FirstOrDefault(t => t.Name == heroType); // => Reflection works, judge take 30p.? //hero = (Character)Activator.CreateInstance(type, new object[] { heroName }); //if (hero == null ) //{ // throw new ArgumentException(string.Format(ExceptionMessages.InvalidCharacterType, heroType)); //} if (heroType == typeof(Warrior).Name) { hero = new Warrior(heroName); } else if (heroType == typeof(Priest).Name) { hero = new Priest(heroName); } else { throw new ArgumentException(string.Format(ExceptionMessages.InvalidCharacterType, heroType)); } this.heroRepo.Add(hero); return(string.Format(SuccessMessages.JoinParty, heroName)); }
//[AllowHtml] - Decorate property public ActionResult Edit(Priest priest, IEnumerable <HttpPostedFileBase> files) { try { if (ModelState.IsValid) { priest = SetFilePath(priest, files); UploadFile(files); db.Entry(priest).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(priest)); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } catch (Exception) { throw; } }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; Character healer = this.characters.FirstOrDefault(c => c.Name == healerName); if (healer == null) { throw new ArgumentException($"Character {healerName} not found!"); } Character receiver = this.characters.FirstOrDefault(c => c.Name == healingReceiverName); if (receiver == null) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } if (healer.GetType().Name == "Warrior") { throw new ArgumentException($"{healer.Name} cannot heal!"); } Priest priest = (Priest)healer; priest.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! " + $"{receiver.Name} has {receiver.Health} health now!"); }
public IEnumerator PriestSpeedUpTimer(Priest self) { self.MoveSpeed += (int)Skillvalue; yield return(new WaitForSeconds(SkilActiveTime)); self.MoveSpeed -= (int)Skillvalue; }
public void LoadResources() { //Load some landscaping static resources groundLeft = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(-3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject; groundLeft.name = "GroundLeft"; groundRight = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject; groundRight.name = "GroundRight"; river = Object.Instantiate(Resources.Load("Prefabs/River"), new Vector3(0, -0.81f, -5.5f), Quaternion.identity) as GameObject; river.name = "River"; //Load important game objects boat = new Boat(1); Vector3[] priestLandPos = new Vector3[3] { new Vector3(-2.9f, 1.1f, -5.5f), new Vector3(-3.4f, 1.1f, -5.5f), new Vector3(-3.9f, 1.1f, -5.5f) }; for (int i = 0; i < 3; i++) { objPriest[i] = new Priest(i, priestLandPos[i]); } Vector3[] devilLandPos = new Vector3[3] { new Vector3(-4.4f, 1.0f, -5.5f), new Vector3(-4.9f, 1.0f, -5.5f), new Vector3(-5.4f, 1.0f, -5.5f) }; for (int i = 0; i < 3; i++) { objDevil[i] = new Devil(i, devilLandPos[i]); } judgement.startTimer(); //StartCoroutine(waitForOneSecond()); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; if (!this.characterParty.ContainsKey(healerName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healerName)); } if (!this.characterParty.ContainsKey(healingReceiverName)) { throw new ArgumentException(string.Format(ExceptionMessages.CharacterNotInParty, healingReceiverName)); } Priest healer = (Priest)this.characterParty.FirstOrDefault(c => c.Key == healerName).Value; if (healer.GetType().Name != nameof(Priest)) { throw new ArgumentException(string.Format(ExceptionMessages.HealerCannotHeal, healerName)); } Character healingReceiver = this.characterParty.FirstOrDefault(c => c.Key == healingReceiverName).Value; healer.Heal(healingReceiver); return(string.Format(SuccessMessages.HealCharacter, healer.Name, healingReceiver.Name, healer.AbilityPoints, healingReceiver.Name, healingReceiver.Health)); }
public ActionResult New() { var priest = new Priest(); return(View("New", priest)); }
public Character ReadClass(int archetype, string wrmc) { int choice; Character player; MyTTY.Show("The following " + wrmc + " are available to you:\n\n"); switch (archetype) { case 1: MyTTY.Show("1) Knight\n"); MyTTY.Show("2) Berserker\n"); break; case 2: MyTTY.Show("1) Hunter\n"); MyTTY.Show("2) Assassin\n"); break; case 3: MyTTY.Show("1) Sorcerer\n"); MyTTY.Show("2) Warlock\n"); break; case 4: MyTTY.Show("1) Priest\n"); MyTTY.Show("2) Druid\n"); break; } choice = MyTTY.ReadIntLimit("\nEnter the number of your selection: ", 2); switch (archetype) { case 1: if (choice < 2) player = new Knight(); else player = new Berserker(); break; case 2: if (choice < 2) player = new Hunter(); else player = new Assassin(); break; case 3: if (choice < 2) player = new Sorcerer(); else player = new Warlock(); break; case 4: if (choice < 2) player = new Priest(); else player = new Druid(); break; default: player = null; } return player; }
private void AddPriestLoss(HSCounter hsc) { Priest priest = new Priest(); priest.LoseButton_Clicked(hsc); }
private void AddPriestWin(HSCounter hsc) { Priest priest = new Priest(); priest.WinButton_Clicked(hsc); }