public override void finishCastandDealDamage(int heroLevel, int heroDamage, Mapping.Level mapLevel, HeroClasses.Hero hero) { for (int i = 0; i < castSquares.Length; i++) { if (mapLevel.Move(hero, castSquares[0], true)) { Audio.playSound("whoosh", 1.0f); cooldown = abilityCooldown; wasJustCast = true; } castSquares[i] = new IntVec(0, 0); } }
public override bool TakeTurn(Mapping.Level mapLevel) { turnOver = false; bool casting = false; int test = health; resetSprite(); if (!visible) { Enemies.Enemy.DeAggroAll(); } updateDOTabilities(mapLevel); if (!isFrozen) { if (MouseController.LeftClicked()) { IInteractable interactableObj = mapLevel.InteractableEnvironment.FindEntity(MouseController.MouseGridPosition()); if (interactableObj != null && Engine.Engine.IsMouseAdjacentToHero()) { Engine.Engine.Log(interactableObj.ToString()); interactableObj.actOn(this); } } if (!casting && !viewingCast) { if (Mapping.KeyboardController.IsTyped(Keys.A)) { turnOver = mapLevel.Move(this, move(Direction.LEFT)); } else if (Mapping.KeyboardController.IsTyped(Keys.W)) { turnOver = mapLevel.Move(this, move(Direction.UP)); } else if (Mapping.KeyboardController.IsTyped(Keys.D)) { turnOver = mapLevel.Move(this, move(Direction.RIGHT)); } else if (Mapping.KeyboardController.IsTyped(Keys.S)) { turnOver = mapLevel.Move(this, move(Direction.DOWN)); } else if (MouseController.LeftClicked()) { attack(mapLevel); } // THESE ARE JUST FOR TESTING else if (Mapping.KeyboardController.IsTyped(Keys.M)) { level += 1; } else if (Mapping.KeyboardController.IsTyped(Keys.LeftShift)) { checkGround(mapLevel); } else if (Mapping.KeyboardController.IsTyped(Keys.RightShift)) { drinkFromJarBar(); } else if (Mapping.KeyboardController.IsPressed(Keys.D1)) { if (abilities[0] != null && abilities[0].cooldown == 0) { viewingCast = true; viewedAbility = 0; abilityKey = Keys.D1; } } else if (Mapping.KeyboardController.IsPressed(Keys.D2)) { if (abilities[1] != null && abilities[1].cooldown == 0) { viewingCast = true; viewedAbility = 1; abilityKey = Keys.D2; } } else if (Mapping.KeyboardController.IsPressed(Keys.D3)) { if (abilities[2] != null && abilities[2].cooldown == 0) { viewingCast = true; viewedAbility = 2; abilityKey = Keys.D3; } } else if (Mapping.KeyboardController.IsPressed(Keys.D4)) { if (abilities[3] != null && abilities[3].cooldown == 0) { viewingCast = true; viewedAbility = 3; abilityKey = Keys.D4; } } else if (Mapping.KeyboardController.IsPressed(Keys.D5)) { if (abilities[4] != null && abilities[4].cooldown == 0) { viewingCast = true; viewedAbility = 4; abilityKey = Keys.D5; } } else if (Mapping.KeyboardController.IsPressed(Keys.D6)) { if (abilities[5] != null && abilities[5].cooldown == 0) { viewingCast = true; viewedAbility = 5; abilityKey = Keys.D6; } } else { turnOver = (Mapping.KeyboardController.IsTyped(Keys.Space)); } } if (viewingCast) { turnOver = castAbility(viewedAbility, mapLevel); if (Mapping.KeyboardController.IsReleased(abilityKey)) { if (abilities[viewedAbility].type != AbilityTypes.Toggle) { Engine.Engine.ClearGridSelections(); abilities[viewedAbility].resetSquares(); } else if (abilities[viewedAbility].cooldown == 0) { abilities[viewedAbility].wasJustCast = false; } viewingCast = !viewingCast; } } if (turnOver) { cooldownAbilities(mapLevel); invisibilityTurnCount -= (!visible) ? 1 : 0; visible = invisibilityTurnCount <= 0; } } else { turnOver = true; } resetArmor(); resetLevel(); CheckElementDamage(); return(turnOver); }