public override IEnumerator CardBehaviour(CardActionResult outcome) { Hex pos = GameplayContext.Player.Position; //TODO: replace this with a line of sight check maybe? List <Entity> targets = GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range); //don't let the player shoot themselves targets.Remove(GameplayContext.Player); SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets); yield return(new WaitUntil(target.IsReadyOrCancelled)); if (!target.WasCancelled()) { Entity victim = target.GetResult(); GameplayContext.Player.DealDamageTo(victim, baseDamage); GameplayContext.Player.TriggerAttackEvent(victim); FXHelper.FireTracerBetween(GameplayContext.Player, victim); FXHelper.PlaySound("rifleShot"); FXHelper.PlaySound(victim.rangedHitSoundName, 0.1f); outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { List <Hex> movementCandidates = new List <Hex>(); //cast out a line in each direction from the player to determine movement spots foreach (Hex dir in Hex.Directions) { List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid, GameplayContext.Player.Position, dir, moveDistance, includeStart: false); movementCandidates.AddRange(line); } // Show the locations to the player and let them pick one SingleHexResult moveLocation = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates); // Wait until the player has made a selection or cancels the action yield return(new WaitUntil(moveLocation.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!moveLocation.WasCancelled()) { // Move to the location they selected GameplayContext.Player.MoveTo(moveLocation.GetResult()); outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Manager.DiscardHand(); GameplayContext.Manager.AttemptDrawCard(n: cardsToDraw); outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { // Get the list of possible locations to move to List <Hex> movementCandidates = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, moveDistance); movementCandidates.Remove(GameplayContext.Player.Position); // Show the locations to the player and let them pick one SingleHexResult moveLocation = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates); // Wait until the player has made a selection or cancels the action yield return(new WaitUntil(moveLocation.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!moveLocation.WasCancelled()) { // Move to the location they selected GameplayContext.Player.MoveTo(moveLocation.GetResult()); FXHelper.PlaySound("MechStep"); outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Player.ApplyStatusEffect(new ArmourLockStatusEffect(blockPercentage)); GameplayContext.Manager.EndPlayerTurn(); outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { //get a list of adjacent entities List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, GameplayContext.Player.Position); //let the player select one of the adjacent entities SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts); //wait for the player to make a selection yield return(new WaitUntil(target.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!target.WasCancelled()) { //hit 'em Entity victim = target.GetResult(); GameplayContext.Player.DealDamageTo(victim, baseDamage); victim.ApplyStatusEffect(new StunStatusEffect()); GameplayContext.Player.TriggerAttackEvent(victim); outcome.Complete(); } else { outcome.Cancel(); } }
//what should the card do when its played, remember to do outcome.Complete or outcome.Cancel public override IEnumerator CardBehaviour(CardActionResult outcome) { Hex pos = GameplayContext.Player.Position; //TODO: replace this with a line of sight check maybe? List <Entity> targets = GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range); targets.Remove(GameplayContext.Player); SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets); yield return(new WaitUntil(target.IsReadyOrCancelled)); if (!target.WasCancelled()) { Entity victim = target.GetResult(); if (victim.Health.HealthAsFraction() <= 0.5f) { baseDamage = baseDamage * 2; } GameplayContext.Player.DealDamageTo(victim, baseDamage); GameplayContext.Player.TriggerAttackEvent(victim); outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { Hex pos = GameplayContext.Player.Position; //TODO: replace this with a line of sight check maybe? List <Entity> targets = GridHelper.GetEntitiesInRange(GameplayContext.Grid, pos, range); List <Hex> allpositions = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 999); //don't let the player shoot themselves targets.Remove(GameplayContext.Player); SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(targets); yield return(new WaitUntil(target.IsReadyOrCancelled)); if (!target.WasCancelled()) { Entity victim = target.GetResult(); GameplayContext.Player.DealDamageTo(victim, baseDamage); victim.ApplyStatusEffect(new StunStatusEffect()); victim.MoveTo(allpositions.PopRandom()); GameplayContext.Player.TriggerAttackEvent(victim); //GameplayContext.Ui.FireTracerBetween(GameplayContext.Player, victim); outcome.Complete(); } else { outcome.Cancel(); } }
//what should the card do when its played, remember to do outcome.Complete or outcome.Cancel public override IEnumerator CardBehaviour(CardActionResult outcome) { //get a list of ranged entities List <Entity> rangedEnts = GridHelper.GetEntitiesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 3); //let the player select one of the enties SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(rangedEnts); //wait for the player to make a selection yield return(new WaitUntil(target.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!target.WasCancelled()) { //hit 'em Entity victim = target.GetResult(); for (int i = 1; i <= 30; i++) { // 30 attacks if (Random.value <= 0.1f) // 10% chance to hit { GameplayContext.Player.DealDamageTo(victim, baseDamage); } } GameplayContext.Player.TriggerAttackEvent(victim); outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { List <Hex> movementCandidates = new List <Hex>(); //cast out a line in each direction from the player to determine movement spots foreach (Hex dir in Hex.Directions) { List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid, GameplayContext.Player.Position, dir, range, includeStart: false); movementCandidates.AddRange(line); movementCandidates.Remove(GameplayContext.Player.Position); } // Show the locations to the player and let them pick one SingleHexResult moveLocation = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates); // Wait until the player has made a selection or cancels the action yield return(new WaitUntil(moveLocation.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!moveLocation.WasCancelled()) { Hex targetpoint = moveLocation.GetResult(); //get all 6 hexes around that point List <Hex> pointsAroundTarget = GridHelper.GetHexesInRange(GameplayContext.Grid, targetpoint, 1, false); //add the point we clicked to that list, so we now have all 7 hexes pointsAroundTarget.Add(targetpoint); pointsAroundTarget.Remove(GameplayContext.Player.Position); //for each hex foreach (Hex spot in pointsAroundTarget) { //find who's standing there Entity victim = GameplayContext.Grid.GetEntityAtHex(spot); if (victim != null) { //hurt them GameplayContext.Player.DealDamageTo(victim, 5); victim.ApplyStatusEffect(new StunStatusEffect()); GameplayContext.Player.TriggerAttackEvent(victim); } } outcome.Complete(); } else { outcome.Cancel(); } }
//TODO: come back and fix this once resistance exists public override IEnumerator CardBehaviour(CardActionResult outcome) { OverclockStatusEffect effect = new OverclockStatusEffect(healthPenalty, damageMultiplier); GameplayContext.Player.ApplyStatusEffect(effect); outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { List <Hex> movementCandidates = new List <Hex>(); //cast out a line in each direction from the player to determine movement spots foreach (Hex dir in Hex.Directions) { List <Hex> line = GridHelper.CastLineInDirection(GameplayContext.Grid, GameplayContext.Player.Position, dir, moveDistance, false, false, true); GridHelper.RemoveOccupiedHexes(GameplayContext.Grid, line); movementCandidates.AddRange(line); } // Show the locations to the player and let them pick one SingleHexResult moveLocation = GameplayContext.Ui.OfferSingleHexSelection(movementCandidates); // Wait until the player has made a selection or cancels the action yield return(new WaitUntil(moveLocation.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!moveLocation.WasCancelled()) { // Move to the location they selected Hex moveDirection = GameplayContext.Player.Position.GetDirectionTo(moveLocation.GetResult()); Hex moveFrom = GameplayContext.Player.Position; Hex movePosition = moveLocation.GetResult(); GameplayContext.Player.MoveTo(moveLocation.GetResult()); int spotsToHit = moveFrom.DistanceTo(GameplayContext.Player.Position); List <Hex> spotsInPath = GridHelper.CastLineInDirection(GameplayContext.Grid, moveFrom, moveDirection, spotsToHit, false, false, true); spotsInPath.Remove(GameplayContext.Player.Position); foreach (Hex spot in spotsInPath) { if (GameplayContext.Grid.GetEntityAtHex(spot) is Entity hit) { if (hit.HasStatusEffect(typeof(WetStatusEffect))) { GameplayContext.Player.DealDamageTo(hit, baseDamage * 2); hit.ApplyStatusEffect(new StunStatusEffect()); GameplayContext.Player.TriggerAttackEvent(hit); } else { GameplayContext.Player.DealDamageTo(hit, baseDamage); } } } outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { //get a list of adjacent entities List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, GameplayContext.Player.Position); //let the player select one of the adjacent entities SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts); //wait for the player to make a selection yield return(new WaitUntil(target.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!target.WasCancelled()) { Entity victim = target.GetResult(); if (victim.Health.HealthAsFraction() <= 0.5f) { baseDamage = baseDamage * 2; } GameplayContext.Player.DealDamageTo(victim, baseDamage); GameplayContext.Player.TriggerAttackEvent(victim); adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, victim.Position); if (adjacentEnts.Contains(GameplayContext.Player)) { adjacentEnts.Remove(GameplayContext.Player); } foreach (Entity toZap in adjacentEnts) { //don't hit terrain if (!toZap.AcceptsStatusEffects) { continue; } //hit 'em Entity victims = target.GetResult(); if (toZap.HasStatusEffect(typeof(WetStatusEffect))) { GameplayContext.Player.DealDamageTo(victims, baseDamage * 2); toZap.ApplyStatusEffect(new StunStatusEffect()); } else { GameplayContext.Player.DealDamageTo(victims, baseDamage); } } outcome.Complete(); } else { outcome.Cancel(); } }
public CardActionResult AttemptToPlay() { if (cardData == null) { throw new InvalidOperationException("Attempted to play a card with no data"); } CardActionResult returnResult = new CardActionResult(); GameplayContext.StartCoroutineOnManager(cardData.CardBehaviour(returnResult)); return(returnResult); }
public override IEnumerator CardBehaviour(CardActionResult outcome) { foreach (Entity victim in GameplayContext.Manager.allEnemies) { //find who's standing there if (victim != null) { //hurt them GameplayContext.Player.DealDamageTo(victim, 7); victim.ApplyStatusEffect(new StunStatusEffect()); GameplayContext.Player.TriggerAttackEvent(victim); } } outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { //get a list of adjacent entities List <Entity> adjacentEnts = GridHelper.GetAdjacentEntities(GameplayContext.Grid, GameplayContext.Player.Position); //let the player select one of the adjacent entities SingleEntityResult target = GameplayContext.Ui.OfferSingleEntitySelection(adjacentEnts); //wait for the player to make a selection yield return(new WaitUntil(target.IsReadyOrCancelled)); // If the player didn't cancel the selection if (!target.WasCancelled()) { //hit 'em Entity victim = target.GetResult(); //get all 6 spots around the player Hex diffVector = GameplayContext.Player.Position - victim.Position; List <Hex> spotsToBurn = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 1, false); spotsToBurn.Remove(diffVector + GameplayContext.Player.Position); //remove the spot behind the target spotsToBurn.Remove(GameplayContext.Player.Position); //don't hit the player foreach (Hex h in spotsToBurn) { if (GameplayContext.Grid.GetEntityAtHex(h) is Entity toHit) { GameplayContext.Player.DealDamageTo(toHit, baseDamage); toHit.ApplyStatusEffect(new BurnStatusEffect(baseDamage, damagePerTurn, turnsRemaining)); GameplayContext.Player.TriggerAttackEvent(toHit); } } outcome.Complete(); } else { outcome.Cancel(); } }
public override IEnumerator CardBehaviour(CardActionResult outcome) { //get all 6 spots around the player List <Hex> spotsToWet = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 1, false); spotsToWet.Remove(GameplayContext.Player.Position); //don't hit the player List <Hex> allpositions = GridHelper.GetHexesInRange(GameplayContext.Grid, GameplayContext.Player.Position, 999); foreach (Hex h in spotsToWet) { if (GameplayContext.Grid.GetEntityAtHex(h) is Entity toHit) { GameplayContext.Player.DealDamageTo(toHit, baseDamage); toHit.MoveTo(allpositions.PopRandom()); toHit.ApplyStatusEffect(new WetStatusEffect(baseDamage, turnsRemaining)); GameplayContext.Player.TriggerAttackEvent(toHit); } } outcome.Complete(); yield break; }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="outcome"></param> /// <returns></returns> public abstract IEnumerator CardBehaviour(CardActionResult outcome);
// Update is called once per frame void Update() { switch (stateStack.Peek()) { case GameState.PlayerIdle: { endTurnButton.interactable = true; } ; break; case GameState.PlayerCardPending: { endTurnButton.interactable = false; if (currentCardAction.IsReadyOrCancelled()) { if (currentCardAction.WasCancelled()) { //card was cancelled, return it to the hand DeselectActiveCard(); } else { //card was played, put it in the discard pile DiscardCard(activeCard); interfaceManager.HideCancelButton(); energy -= GameplayContext.ActiveCard.cardData.energyCost; UpdatePlayerStatusEffectPanel(); } CleanDeadEnemies(); stateStack.Pop(); currentCardAction = null; GameplayContext.ActiveCard = null; } }; break; case GameState.EnemyTurn: { endTurnButton.interactable = false; if (turnTimer > 0) { turnTimer -= Time.deltaTime; } else { if (enemyTakingTurn is null) { StartNextEnemyTurn(); } else if (enemyTurnFinished) { turnTimer = timeBetweenTurns; } } }; break; case GameState.DrawingCards: { endTurnButton.interactable = false; if (cardDrawTimer <= 0) { DrawCard(); cardsLeftToDraw--; cardDrawTimer = cardDrawPause; //Debug.Log("Drew 1, " + cardsLeftToDraw + "cards remain"); } else { cardDrawTimer -= Time.deltaTime; } //stop drawing cards if empty or finished if ((drawPile.Count == 0 && discardPile.Count == 0) || cardsLeftToDraw == 0) { cardDrawTimer = 0; stateStack.Pop(); } }; break; } playerHealthBar.Value = player.Health.Current; drawPileNumber.text = drawPile.Count.ToString(); discardPileNumber.text = discardPile.Count.ToString(); energyNumber.text = energy.ToString(); if (worldGrid.GetHexUnderMouse() is Hex mousehex && worldGrid.GetEntityAtHex(mousehex) is Entity entUnderMouse && entUnderMouse != player) { enemyText.enabled = true; enemyText.text = entUnderMouse.entityName; enemyHealthBar.gameObject.SetActive(true); enemyHealthBar.MaxValue = entUnderMouse.Health.MaxHealth; enemyHealthBar.Value = entUnderMouse.Health.Current; enemyStatusEffectPanel.gameObject.SetActive(true); UpdateEnemyStatusEffectPanel(entUnderMouse); GameplayContext.EntityUnderMouse = entUnderMouse; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Player.ApplyStatusEffect(new IgniteStatusEffect(increasePrecentage)); outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Player.ApplyStatusEffect(new WaterWallStatusEffect(blockPercentage, turns)); outcome.Complete(); yield break; }
public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Player.ApplyStatusEffect(new ChargeStatusEffect()); outcome.Complete(); yield break; }
//what should the card do when its played, remember to do outcome.Complete or outcome.Cancel public override IEnumerator CardBehaviour(CardActionResult outcome) { throw new System.NotImplementedException(); }
//what should the card do when its played, remember to do outcome.Complete or outcome.Cancel public override IEnumerator CardBehaviour(CardActionResult outcome) { GameplayContext.Manager.energy += energyIncrease; outcome.Complete(); yield break; }