static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var list = new List <HeroFactory>(); HeroFactory hero = null; for (int i = 0; i < n; i++) { var nameHero = Console.ReadLine(); var typeHero = Console.ReadLine(); if (!ValidateHero(typeHero)) { Console.WriteLine("Invalid hero!"); i--; continue; } hero = CreateHero(list, hero, nameHero, typeHero); } var bossPower = int.Parse(Console.ReadLine()); int totPawor = 0; foreach (var heroPower in list) { Console.WriteLine(heroPower.GetHero().CastAbility()); totPawor += heroPower.GetHero().Power; } var result = totPawor >= bossPower ? "Victory!" : "Defeat..."; Console.WriteLine(result); }
void CreateEnemyHeroes() { for (int i = 0; i < ENEMY_SIDE_COUNT; ++i) { m_EnemyHeroes.Add(HeroFactory.GetNewEnemyHero()); } }
private void CreateHero() { this.writer.Write(string.Format(EngineConstants.CreateHeroGreetingMessage, Environment.NewLine) + string.Format(EngineConstants.CreateHeroMesage, Environment.NewLine)); string playerName = this.reader.ReadLine(); playerName = this.InitHeroName(playerName); this.writer.Clear(); char cki; int heroId; this.writer.WriteLine(GameConstants.ChooseHero + Environment.NewLine); foreach (object heroType in this.heroTypes) { this.writer.WriteLine(string.Format(EngineConstants.HeroTypeToChooseMessage, Array.IndexOf(this.heroTypes, heroType) + 1, heroType)); } cki = this.reader.ReadKey(); while (!char.IsNumber(cki) || !Enum.IsDefined(typeof(Hero), int.Parse(cki.ToString()))) { Console.ForegroundColor = ConsoleColor.Red; this.writer.WriteLine(string.Format(EngineConstants.ChooseRaceWrongChoice, Environment.NewLine)); Console.ForegroundColor = ConsoleColor.Yellow; cki = this.reader.ReadKey(); } heroId = int.Parse(cki.ToString()); this.hero = HeroFactory.CreateHero(heroId, playerName); this.ShowHeroStartingInfo(); }
static void Main(string[] args) { VehicleFactory honda = new HondaFactory(); VehicleClient hondaclient = new VehicleClient(honda, "Regular"); Console.WriteLine("******* Honda **********"); Console.WriteLine(hondaclient.GetBikeName()); Console.WriteLine(hondaclient.GetScooterName()); hondaclient = new VehicleClient(honda, "Sports"); Console.WriteLine(hondaclient.GetBikeName()); Console.WriteLine(hondaclient.GetScooterName()); VehicleFactory hero = new HeroFactory(); VehicleClient heroclient = new VehicleClient(hero, "Regular"); Console.WriteLine("******* Hero **********"); Console.WriteLine(heroclient.GetBikeName()); Console.WriteLine(heroclient.GetScooterName()); heroclient = new VehicleClient(hero, "Sports"); Console.WriteLine(heroclient.GetBikeName()); Console.WriteLine(heroclient.GetScooterName()); Console.ReadKey(); }
static void Main(string[] args) { var factory = new HeroFactory( new ElfBeast("protecting"), new ElfMage("cooking"), new ElfWarlord("cleaning")); var beast = factory.createBeast(); var mage = factory.createMage(); var warlord = factory.createWarlord(); Console.WriteLine(beast.ToString()); Console.WriteLine(mage.ToString()); Console.WriteLine(warlord.ToString()); factory = new HeroFactory( new OrcBeast("laser"), new OrcMage("axe"), new OrcWarlord("sword")); beast = factory.createBeast(); mage = factory.createMage(); warlord = factory.createWarlord(); Console.WriteLine(beast.ToString()); Console.WriteLine(mage.ToString()); Console.WriteLine(warlord.ToString()); }
public void OnCreate() { SimpleHero hero = HeroFactory.SetupPlacableHero(TemHeroType); hero.transform.position = HeroIcon.transform.position; hero.SelectAndDraw(); }
static void Main(string[] args) { // i dont need to know which specific super hero i'm calling // i only know i need someone for an "intelligence situation" ISuperHero superHero = HeroFactory.InitializeFactories().GetHero(ESituationType.Intelligence); Console.WriteLine(superHero.HeroName); Console.WriteLine(superHero.GetDescription()); }
void SpawnNewHero(Vector3 position) { hero = HeroFactory.InstantiateRandom(); hero.transform.position = position; hero.onHitExit += GoToNextFloor; hero.onDead += OnHeroDead; heroController = hero.gameObject.AddComponent <HeroController>(); hero.gameObject.AddComponent <AudioListener>(); }
public Player(Dungeon dungeon) { Dungeon = dungeon; CurrentLocation = Dungeon.EntranceLocation; PillarsFound = 0; PotionsFound = 0; MonstersBattled = 0; TrapsEncountered = 0; Character = HeroFactory.MakeHero(); }
public void Test() { for (int i = 0; i < transform.childCount; i++) { DestroyImmediate(transform.GetChild(i).gameObject); } var hero = HeroFactory.InstantiateRandom(); hero.transform.SetParent(transform, false); }
void RemoveUsedHeroes() { HeroFactory.UpdateAvailableHeros(); Dictionary <int, HeroInfoBase> dict = HeroInfoBase.data; foreach (HeroData hero in m_OwnedHeroes) { dict.Remove(hero.HashCode); } }
public void AddNewHero() { if (m_OwnedHeroes.Count < 10) { m_OwnedHeroes.Add(HeroFactory.GetNewAllyHero()); EventMessenger.NotifyEvent(SaveEvents.SAVE_GAME_STATE); } EventMessenger.NotifyEvent(HeroEvents.HERO_ADDED); }
public string Execute(string[] inputArgs) { string heroType = inputArgs[2]; string heroName = inputArgs[3]; HeroFactory heroFactory = new HeroFactory(); var hero = heroFactory.Create(heroType, heroName); LoadUtilities.LoadHeroRepository().Add(hero); return($"Successful create new Hero {heroType} - {heroName}"); }
public static void Main() { IInputReader inputReader = new ConsoleInputReader(); IOutputWriter outputWriter = new ConsoleOutputWriter(); IHeroFactory factory = new HeroFactory(); IInventory inventory = new HeroInventory(); IList <IHero> heroes = new List <IHero>(); IManager manager = new HeroManager(factory, inventory, heroes); Engine engine = new Engine(inputReader, outputWriter, manager); engine.Run(); }
public static void Main() { IInputReader reader = new ConsoleReader(); IOutputWriter writer = new ConsoleWriter(); IHeroFactory heroFactory = new HeroFactory(); ICommonItemFactory commonItemFactory = new CommonItemFactory(); IRecipeFactory recipeFactory = new RecipeFactory(); IManager manager = new HeroManager(); Engine engine = new Engine(reader, writer, manager, heroFactory, commonItemFactory, recipeFactory); engine.Run(); }
public static void Main() { IReader reader = new Reader(); IWriter writer = new Writer(); IUnitFactory unitFactory = new UnitFactory(); IHeroFactory heroFactory = new HeroFactory(); IItemFactory itemFactory = new ItemFactory(); IGameController gameController = new GameController(unitFactory, heroFactory, itemFactory); ICommandInterpreter commandInterpreter = new CommandInterpreter(gameController); IEngine engine = new Engine(reader, writer, commandInterpreter); engine.Run(); }
/// Network void OnPlaceHeroNetwork(LogicArg arg) { if (MState == State.WaitPlaceHero) { PlaceHeroMessage msg = (PlaceHeroMessage)arg.GetMessage("msg"); foreach (RawHeroInfo hInfo in msg.heroInfo) { hInfo.block = BattleField.GetReflectBlock(hInfo.block); hInfo.direction = BattleField.GetReflectDirection(hInfo.direction); HeroFactory.SetUpEnemyHero(hInfo); } m_stateMachine.State = State.Strategy; } }
static void Main(string[] args) { Console.WriteLine("Creating a new Monster -> Horse"); var horse = MonsterFactory.CreateMonster(MonsterType.Horse); Console.WriteLine($"Horse kick damage: {horse.KickDamage}"); Console.WriteLine($"Horse punch damage: {horse.PunchDamage}"); // <--- Exception Console.WriteLine("Creating a new Hero -> Guile"); var guile = HeroFactory.CreateHero(HeroType.Guile); Console.WriteLine($"Guile kick damage: {guile.KickDamage}"); Console.WriteLine($"Guile Tektektuguem damage: {guile.TektektuguemDamage}"); // <--- Exception }
public static void Main() { IReader reader = new ConsoleReader(); IWriter writer = new ConsoleWriter(); IHeroRepository heroRepository = new HeroRepository(new Dictionary <string, IHero>()); IHeroFactory heroFactory = new HeroFactory(); IItemFactory itemFactory = new ItemFactory(); IRecipeFactory recipeFactory = new RecipeFactory(); ICommandInterpreter commandInterpreter = new CommandInterpreter(heroRepository, heroFactory, itemFactory, recipeFactory); Engine engine = new Engine(reader, writer, commandInterpreter); engine.Run(); }
public static void Main() { IInputReader reader = new ConsoleReader(); IOutputWriter writer = new ConsoleWriter(); var heroFactory = new HeroFactory(); var itemFactory = new ItemFactory(); var recipeFactory = new RecipeFactory(); IManager manager = new HeroManager(heroFactory, itemFactory, recipeFactory); Engine engine = new Engine(reader, writer, manager); engine.Run(); }
public void Run() { HeroFactory heroFactory = new HeroFactory(); List <BaseHero> raidGroup = new List <BaseHero>(); int countOfNeededlHeroes = int.Parse(Console.ReadLine()); while (raidGroup.Count < countOfNeededlHeroes) { string name = Console.ReadLine(); string type = Console.ReadLine(); try { BaseHero newHero = heroFactory.CreateHero(name, type); raidGroup.Add(newHero); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } } long bossPower = long.Parse(Console.ReadLine()); long raidGroupPower = default; if (raidGroup.Count > 0) { raidGroupPower = GetAllHeroesPowers(raidGroup); } if (raidGroup.Count > 0) { if (raidGroupPower >= bossPower) { Console.WriteLine(VICTORY_MSG); } else { Console.WriteLine(DEFEAT_MSG); } } else { Console.WriteLine(DEFEAT_MSG); } }
void AddUsedHeroes() { if (m_OwnedHeroes == null) { return; } Dictionary <int, HeroInfoBase> dict = HeroInfoBase.data; foreach (HeroData hero in m_OwnedHeroes.Where(hero => hero.CreatedFromRecipe)) { dict[hero.HashCode] = Resources.FindObjectsOfTypeAll <HeroInfoBase>().Where(heroBase => heroBase.heroName == hero.HeroName).First(); } HeroFactory.ResetAvailableHeroes(); }
public static void SetUpVirtualHeros() { for (int i = 0; i < Instance.gridWidth; ++i) { for (int j = 0; j < Instance.gridHeight; ++j) { if (Instance.m_normalBlockGrid [i, j].State == Block.BlockState.Hero) { HeroType type = Instance.m_normalBlockGrid [i, j].GetHeroInfo().type; Hero hero = HeroFactory.SetupVirtualHero(type); virtualHeroList.Add(hero); virtualHeroMap [Instance.m_normalBlockGrid [i, j].GetHeroInfo().parent] = hero; Instance.m_virtualBlockGrid [i, j].RegisterHero(hero); } } } }
public IHero CreateHero(Heroes hero, HeroSide side) { var result = HeroFactory.CreateHero(entityRoot, hero, side, Game.Levels.CurrentLevel.GetHeroSpawn(side)); if (side == HeroSide.Top) { Game.Hud.CurrentHud.ScoreBar.AttachHero(HeroSide.Top, result); TopHero = result; } else { Game.Hud.CurrentHud.ScoreBar.AttachHero(HeroSide.Bottom, result); BottomHero = result; } Game.Hud.CurrentHud.GetHeroController(side).AttachHero(result); return(result); }
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 = HeroFactory.CreateHero(args); if (hero == null) { return($"Invalid type hero: {type}."); } _heroes.Add(heroName, hero); return($"{type}: {heroName} joined the Arena!"); }
//customize the hero with your own stats public void customizeHero() { HeroFactory heroFactory = new HeroFactory(); myHero = heroFactory.getHero(HeroTypes.Custom); int health = 0, damage = 0, gold = 0; string name = ""; Console.WriteLine("Introduce the name of your hero: "); name = Console.ReadLine(); while (health < 1 || health > 1000) { Console.WriteLine("Introduce " + name + "'s Health (between 1 to 1000): "); health = Convert.ToInt32(Console.ReadLine()); } while (damage < 1 || damage > 100) { Console.WriteLine("Introduce " + name + "'s Damage (between 1 to 100): "); damage = Convert.ToInt32(Console.ReadLine()); } while (gold < 1 || gold > 5000) { Console.WriteLine("Introduce " + name + "'s Gold (between 1 and 5000): "); gold = Convert.ToInt32(Console.ReadLine()); } myHero.Health = health; myHero.Damage = damage; myHero.Gold = gold; myHero.Name = name; myHero.showStats(); }
//choose iron man/hulk/spiderman public void chooseYourHero() { HeroFactory heroFactory = new HeroFactory(); int heroType = 0; while (heroType <= 0 || heroType > Enum.GetNames(typeof(HeroTypes)).Length) { Console.WriteLine("Choose your favorite hero:\n"); Console.WriteLine("Iron Man - press 1\n"); Console.WriteLine("Hulk - press 2\n"); Console.WriteLine("Spiderman - press 3\n"); Console.WriteLine("-----------------------\n"); Console.WriteLine("IronMan has more gold\n"); Console.WriteLine("Hulk has more health\n"); Console.WriteLine("Spiderman has more damage\n"); heroType = Convert.ToInt32(Console.ReadLine()); } myHero = heroFactory.getHero((HeroTypes)(heroType - 1)); switch (heroType) { case 1: { Console.WriteLine("Iron Man selected!\n"); break; } case 2: { Console.WriteLine("Hulk selected!\n"); break; } case 3: { Console.WriteLine("Spiderman selected!\n"); break; } default: { Console.WriteLine(); break; } } Console.WriteLine("Your hero's stats are:"); myHero.showStats(); }
private static HeroFactory CreateHero(List <HeroFactory> list, HeroFactory hero, string nameHero, string typeHero) { switch (typeHero) { case "Druid": hero = new DruidFactory(nameHero); break; case "Paladin": hero = new PaladinFactory(nameHero); break; case "Rogue": hero = new RogueFactory(nameHero); break; case "Warrior": hero = new WarriorFactory(nameHero); break; } list.Add(hero); return(hero); }
public void Run() { HeroFactory heroFactory = new HeroFactory(); int n = int.Parse(Console.ReadLine()); int counter = 0; while (n != counter) { string name = Console.ReadLine(); string type = Console.ReadLine(); BaseHero hero = null; try { hero = this.heroFactory.Create(name, type); this.heroes.Add(hero); counter++; } catch (InvalidOperationException ioe) { Console.WriteLine(ioe.Message); } } int bossPower = int.Parse(Console.ReadLine()); foreach (var hero in heroes) { Console.WriteLine(hero.CastAbility()); } int heroPower = heroes.Sum(h => h.Power); WonOrNot(bossPower, heroPower); }
public HeroManager() { this.heroes = new Dictionary <string, IHero>(); this.heroFactory = new HeroFactory(); }
static void Main(string[] args) { VehiculoFactory honda = new HondaFactory(); VehiculoClient hondaclient = new VehiculoClient(honda, "Regular"); Console.WriteLine("******* Honda **********"); Console.WriteLine(hondaclient.obtenerbiciNombre()); Console.WriteLine(hondaclient.GetScooterNombre()); hondaclient = new VehiculoClient(honda, "Deportes"); Console.WriteLine(hondaclient.obtenerbiciNombre()); Console.WriteLine(hondaclient.GetScooterNombre()); VehiculoFactory hero = new HeroFactory(); VehiculoClient heroclient = new VehiculoClient(hero, "Regular"); Console.WriteLine("******* Hero **********"); Console.WriteLine(heroclient.obtenerbiciNombre()); Console.WriteLine(heroclient.GetScooterNombre()); heroclient = new VehiculoClient(hero, "Deportes"); Console.WriteLine(heroclient.obtenerbiciNombre()); Console.WriteLine(heroclient.GetScooterNombre()); Console.ReadKey(); }