/// <summary> /// Initializes a new instance of the <see cref="Arena"/> class. /// </summary> /// <param name="name">The battle name</param> /// <param name="fightRules">Fighting rules for damage calculator</param> /// <param name="ninja">Our ninja</param> /// <param name="creature">Enemy to fight with the ninja</param> public Arena(string name, FightRulesEnum fightRules, Ninja ninja, Evil creature) : base(name) { this.fightRules = fightRules; this.creature = creature; this.ninja = ninja; HitCalculator.SetFightRusles(fightRules); }
public static void Main() { var pain = new Evil[] { new Evil { Yeuch = 2 } }; pain[0].Yeuch = 27; Console.WriteLine(pain[0].Yeuch); }
static void Test() { int i; DynamicMethod mthd = new DynamicMethod("Evil", null, new Type[] { typeof(int).MakeByRefType() }); mthd.GetILGenerator().Emit(OpCodes.Ret); // just return; no assignments Evil <int> evil = (Evil <int>)mthd.CreateDelegate(typeof(Evil <int>)); evil(out i); Console.WriteLine(i); }
private static void MoveEvil(Evil evil, int[,] matrix) { while (evil.Row >= 0) { if (evil.Row < matrix.GetLength(0) && evil.Col >= 0 && evil.Col < matrix.GetLength(1)) { matrix[evil.Row, evil.Col] = 0; } evil.UpdateCoordinates(evil.Row - 1, evil.Col - 1); } }
public static uint[] GetUInts(this Color[] colors) { if (colors == null) { throw new ArgumentNullException("colors"); } Evil e = new Evil { Colors = colors }; return(e.UInts); }
public void MoveEvilToTopLeftCorner(Evil evil) { while (evil.Row >= 0 && evil.Col >= 0) { if (IsInside(evil.Row, evil.Col)) { this.galaxyMatrix[evil.Row, evil.Col] = 0; } evil.Row--; evil.Col--; } }
public void ApplyForJob(Ninja ninja, Job chosenJob) { Evil enemy = this.ChooseEnemy(chosenJob); Arena fight = new Arena(string.Format("Fighting for '{0}' position", chosenJob.Possition), chosenJob.JobFightRules, ninja, enemy); fight.Fight(); if (fight.IsNinjaWiner) { this.RewardNinja(ninja, chosenJob); } else { // ToDo: ??any string message for the looser } }
private static void UpdateCoordinates(string command, Ivo ivo, Evil evil) { var ivoCoordinates = command .Split(' ', StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); ivo.UpdateCoordinates(ivoCoordinates[0], ivoCoordinates[1]); command = Console.ReadLine(); var evilCoordinates = command .Split(' ', StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); evil.UpdateCoordinates(evilCoordinates[0], evilCoordinates[1]); }
static void Main() { int[] dimensions = Console.ReadLine() .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); int rowsCount = dimensions[0]; int colsCount = dimensions[1]; var field = new Matrix(rowsCount, colsCount); string command = ""; var ivos = new Good(); while ((command = Console.ReadLine()) != "Let the Force be with you") { int[] evilStartCoordinates = Console.ReadLine() .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); var evil = new Evil(evilStartCoordinates[0], evilStartCoordinates[1]); field = evil.Destroy(field); int[] ivosStartCoordinates = command .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); if (ivos.Sum == -1) { ivos = new Good(ivosStartCoordinates[0], ivosStartCoordinates[1]); } else { ivos.Row = ivosStartCoordinates[0]; ivos.Col = ivosStartCoordinates[1]; } ivos.MoveAndSum(field); } Console.WriteLine(ivos.Sum); }
public static void EvilMove(int[,] field) { if (Evil.x - Player.x > 0) { Evil.MoveUp(field); // Up } if (Evil.y - Player.y > 0) { Evil.MoveLeft(field); // Left } if (Evil.y - Player.y < 0) { Evil.MoveRight(field); // Right } if (Evil.x - Player.x < 0) { Evil.MoveDown(field); // Down } field[Evil.x, Evil.y] = 6; }
private static long ColectingHearths(Space galaxy) { string loverData; long sum = 0L; Coordinates coordinates = new Coordinates(); Evil evil = new Evil(); Lover ivo = new Lover(); while ((loverData = Console.ReadLine()) != "Let the Force be with you") { evil = new Evil(new Coordinates(Console.ReadLine())); evil.RemoveStars(galaxy); ivo = new Lover(sum, new Coordinates(loverData)); ivo.ColectingStars(galaxy, ivo.StarsColected); sum = ivo.StarsColected; //<----------------------този ред липсваше!!! } return(ivo.StarsColected); }
static void Main(string[] args) { short[] sizes = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .Select(short.Parse) .ToArray(); var matrix = InitializeMatrix(sizes); var ivo = new Ivo(); var evil = new Evil(); string command; while ((command = Console.ReadLine()) != "Let the Force be with you") { UpdateCoordinates(command, ivo, evil); MoveEvil(evil, matrix); MoveIvo(ivo, matrix); } Console.WriteLine(ivo.Score); }
public static void Body(int fieldsize, int[,] field) { { while (Game.win == false & Evil.win == false) { if (field[Player.x, Player.y] == 6) { if (Player.Level > Evil.Power) { Evil.x = Evil.y = fieldsize - 2; Evil.Power = Evil.Level + Evil.Power + 1; } else { Evil.win = true; } } Evil.Power = Evil.Level + 1; if (Player.Level == Game.ArtefactWin) { Game.win = true; } Player.PlayerMove(fieldsize, field); Evil.EvilMove(field); Console.Clear(); Game.GameFieldRender(fieldsize, field); if (Game.ToMany == true) { Game.ArtefactWin = Game.Allartefacts - Evil.Level; } if ((Player.Level + (Game.Allartefacts - Evil.Level)) <= Game.ArtefactWin) { Evil.win = true; } Console.WriteLine($"Артефактов/мощь у игрока игрока {Player.Level}, Артефактов у Зла {Evil.Level}, мощь Зла {Evil.Power}"); } } }
private void OpenStatistic_Click(object sender, RoutedEventArgs e) { if (Height < Settings.fieldHeight + 200) { Height = Settings.fieldHeight + 200; } Binding binding = new Binding(); binding.StringFormat = Languages.Statistic.PeacStatistic + "{0}"; binding.Path = new PropertyPath("allTimePeacCounter"); Peac.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.EvilStatistic + "{0}"; binding.Path = new PropertyPath("allTimeEvilCounter"); Evil.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxSpeed"); MaxSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxRotationSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxRotationSpeed"); MaxRotationSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxMaxHealSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxMaxHeal"); MaxMaxHealSpeed.SetBinding(TextBlock.TextProperty, binding); binding = new Binding(); binding.StringFormat = Languages.Statistic.MaxMaxAgeSpeedStatistic + "{0}"; binding.Path = new PropertyPath("maxMaxAge"); MaxMaxAgeSpeed.SetBinding(TextBlock.TextProperty, binding); }
public static void MoveLeft(int[,] field) { if (Evil.y - Player.y > 0) { switch (field[Evil.x, Evil.y - 1]) { case 3: Evil.ExitWall(field); break; case 4: Evil.Level += 1; field[Evil.x, Evil.y] = 9; Evil.y -= 1; break; default: field[Evil.x, Evil.y] = 9; Evil.y -= 1; break; } } }
public static void MoveDown(int[,] field) { if (Evil.x - Player.x < 0) { switch (field[Evil.x + 1, Evil.y]) { case 3: Evil.ExitWall(field); break; case 4: Evil.Level += 1; field[Evil.x, Evil.y] = 9; Evil.x += 1; break; default: field[Evil.x, Evil.y] = 9; Evil.x += 1; break; } } }
public static void Main() { var sizes = Console.ReadLine() .Split() .Select(int.Parse) .ToArray(); FillUpMatrix(sizes); Playa ivo = new Playa(); Evil evil = new Evil(); string command; while ((command = Console.ReadLine()) != "Let the Force be with you") { ivo.SetCoordinates(command); evil.SetCoordinates(Console.ReadLine()); evil.DestroyStars(matrix); ivo.CollectPoints(matrix); } Console.WriteLine(ivo.Points); }
public override string ToString() { string[] asd = { Name, Health.ToString(), Strength.ToString(), Charge.ToString(), Evil.ToString() }; return(string.Join(" ", asd)); //return Name + " " + Health + " " + Strength + " " + Charge + " " + Evil; }