private Comb[] Rows; //Все возможные линейные комбинации точек #endregion Fields #region Constructors public Game() { // started = true; finished = false; Pl1 = new Player(1); Pl2 = new Player(2); Cube = new Place[4, 4, 4]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { int num = (i + 1) * 100 + (j + 1) * 10 + (k + 1); Cube[i, j, k] = new Place(num); if (j == 0) { Cube[i, j, k].SetAvailable(); } } } } //==============инициализация рядов===================== Rows = new Comb[76]; //--------------XY.Init--------------------------------- int rownum = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int k = 0; k < 4; k++) { Rows[rownum].Row[k] = (i + 1) * 100 + (j + 1) * 10 + (k + 1); Cube[i, j, k].WriteLine(rownum); } rownum++; } } //--------------XZ.Init--------------------------------- for (int i = 0; i < 4; i++) { for (int k = 0; k < 4; k++) { Rows[rownum] = new Comb(); for (int j = 0; j < 4; j++) { Rows[rownum].Row[j] = (i + 1) * 100 + (j + 1) * 10 + (k + 1); Cube[i, j, k].WriteLine(rownum); } rownum++; } } //--------------YZ.Init--------------------------------- for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (j + 1) * 10 + (k + 1); Cube[i, j, k].WriteLine(rownum); } rownum++; } } //-------------XZ.diagonal.Init------------------------- for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (j + 1) * 10 + (i + 1); Cube[i, j, i].WriteLine(rownum); } rownum++; } for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (j + 1) * 10 + (3 - i + 1); Cube[i, j, 3 - i].WriteLine(rownum); } rownum++; } //-------------XY.diagonal.Init------------------------- for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (i + 1) * 10 + (j + 1); Cube[i, i, j].WriteLine(rownum); } rownum++; } for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (3 - i + 1) * 10 + (j + 1); Cube[i, 3 - i, j].WriteLine(rownum); } rownum++; } //-------------YZ.diagonal.Init------------------------- for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (j + 1) * 100 + (i + 1) * 10 + (i + 1); Cube[j, i, i].WriteLine(rownum); } rownum++; } for (int j = 0; j < 4; j++) { Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (j + 1) * 100 + (3 - i + 1) * 10 + (i + 1); Cube[j, 3 - i, i].WriteLine(rownum); } rownum++; } //-------------XYZ.diagonal.Init------------------------- Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (i + 1) * 10 + (i + 1); Cube[i, i, i].WriteLine(rownum); } rownum++; Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (3 - i + 1) * 100 + (i + 1) * 10 + (i + 1); Cube[3 - i, i, i].WriteLine(rownum); } rownum++; Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (3 - i + 1) * 10 + (i + 1); Cube[i, 3 - i, i].WriteLine(rownum); } rownum++; Rows[rownum] = new Comb(); for (int i = 0; i < 4; i++) { Rows[rownum].Row[i] = (i + 1) * 100 + (i + 1) * 10 + (3 - i + 1); Cube[i, i, 3 - i].WriteLine(rownum); } //==========конец инициализации=========================== Pl1.Turn = true; }
public void OnExecuteAction(Player sender, ExecuteOrderEventArgs args) { if (Hero.IsInvisible()) { return; } switch (args.Order) { case Order.TransferItem: case Order.MoveItem: case Order.DropItem: case Order.PickItem: case Order.BuyItem: Sleeper.Sleep(200 + Game.Ping, itemManager); break; case Order.AttackTarget: case Order.AttackLocation: if (itemManager.PowerTreads.IsValid()) { var attribute = itemManager.PowerTreads.GetAttackAttribute(); if (attribute != itemManager.PowerTreads.ActiveAttribute) { itemManager.PowerTreads.SwitchTo(attribute); heroAttacking = true; } } break; case Order.AbilityTarget: case Order.AbilityLocation: case Order.Ability: case Order.ToggleAbility: if (!args.IsQueued) { var abilityClassID = args.Ability.ClassID; if (abilityClassID == ClassID.CDOTA_Item_TeleportScroll || abilityClassID == ClassID.CDOTA_Item_BootsOfTravel || abilityClassID == ClassID.CDOTA_Item_BootsOfTravel_2) { Sleeper.Sleep(1000, "Main"); return; } UseAbility(args); } break; case Order.MoveLocation: case Order.MoveTarget: if (Menu.Recovery.Active) { itemManager.PickUpItemsOnMove(args); } if (itemManager.PowerTreads.IsValid() && !itemManager.PowerTreads.DelaySwitch() && !Sleeper.Sleeping("SwitchBackPT")) { var attribute = itemManager.PowerTreads.GetMoveAttribute(); if (attribute != itemManager.PowerTreads.ActiveAttribute) { itemManager.PowerTreads.SwitchTo(attribute); itemManager.PowerTreads.DefaultAttribute = attribute; heroAttacking = false; } } break; default: heroAttacking = false; break; } }