public List <Square> GetAOE(List <Square> _starting, EffectStat _effect) { List <Square> toReturn = new List <Square>(_starting); List <Square> tempo = new List <Square>(toReturn); if (_effect.EffectRangeType == e_rangeType.Default) { for (int i = 0; i < _effect.EffectRange; i++) { tempo = new List <Square>(toReturn); foreach (Square s in toReturn) { int x = s.Position.x; int y = s.Position.y; if (x > 0) { tempo.Add(board[x - 1, y]); } if (x < mapSize.x - 1) { tempo.Add(board[x + 1, y]); } if (y > 0) { tempo.Add(board[x, y - 1]); } if (y < mapSize.y - 1) { tempo.Add(board[x, y + 1]); } } foreach (Square s in tempo) { if (!toReturn.Contains(s)) { toReturn.Add(s); } } } } else if (_effect.EffectRangeType == e_rangeType.Straight) { tempo = new List <Square>(toReturn); Vector2Int[] directions = new Vector2Int[] { new Vector2Int(1, 0), new Vector2Int(0, 1), new Vector2Int(-1, 0), new Vector2Int(0, -1) }; for (int i = 0; i < directions.Length; i++) { tempo.AddRange(GetRangeInDirection(_starting[0], directions[i], _effect.EffectRange, null, true)); } toReturn = tempo; } else if (_effect.EffectRangeType == e_rangeType.Diagonal) { tempo = new List <Square>(toReturn); Vector2Int[] directions = new Vector2Int[] { new Vector2Int(1, 1), new Vector2Int(-1, -1), new Vector2Int(-1, 1), new Vector2Int(1, -1) }; for (int i = 0; i < directions.Length; i++) { tempo.AddRange(GetRangeInDirection(_starting[0], directions[i], _effect.EffectRange, null, true)); } toReturn = tempo; } return(toReturn); }
//InGame public void ClickOnHero(HeroPiece _piece) { if (step == e_step.Placement) { PlacementHero(_piece); return; } if (selectedActive != null) { if (_piece == selectedActive.Piece) { Unselection(); } else { Square square = board[_piece.Position.x, _piece.Position.y]; if (activeList.Contains(square)) { Square[] targets = new Square[] { square }; selectedActive.Piece.ActivePower(targets); Unselection(); } } } else if (selectedPiece != null) { if (_piece == selectedPiece) { canUnselect = true; } else if (_piece.Team != gameplayManager.Team) { Square square = board[_piece.Position.x, _piece.Position.y]; if (attackList.Contains(square)) { if (selectedPiece.CanMove > 0) { selectedPiece.NotifyMovement(AttackPath(square), true); } Square[] targets = new Square[] { square }; selectedPiece.Attack(targets); selectedPiece.HighLight(false); selectedPiece = null; } Unselection(); } else if (_piece != selectedPiece) { Unselection(); } } else if (_piece.Team == gameplayManager.Team) { if (_piece.CanMove > 0 || _piece.CanAct > 0) { Unselection(); selectedPiece = _piece; selectedPiece.HighLight(true); canUnselect = false; ClickDrag(_piece.transform); Ability atck = selectedPiece.Hero.Attack; EffectStat ef = (EffectStat)atck.Effects[0]; ef.Value = -selectedPiece.Stats[e_stats.Damage].CurrentValue; atck.Range = selectedPiece.Stats[e_stats.Range].CurrentValue; atck.GetOccupied = true; Ability mov = selectedPiece.Hero.Move; List <e_squareType> exceps = new List <e_squareType>(); if (selectedPiece.Hero.Fly == false) { exceps.Add(e_squareType.Obstacle); } mov.Range = selectedPiece.Stats[e_stats.Speed].CurrentValue; mov.GetOccupied = false; mov.Exceptions = exceps; HighlightHeroRanges(); } } }
private string GenerateDescription() { string desc = string.Empty; string colorID = string.Empty; foreach (Effect ef in card.Effects) { desc += "- "; EffectStat st = ef as EffectStat; EffectDraw dr = ef as EffectDraw; if (st != null) { colorID = ColorUtility.ToHtmlStringRGB(GameplayManager.Instance.Data.GetColor(st.Stat)); desc += "<color=#" + colorID + ">"; desc += st.Value > 0 ? "+" : "-"; desc += Mathf.Abs(st.Value); desc += "</color>"; desc += " "; desc += st.Stat.ToString(); desc += " "; e_rangeType rangeType = card.RangeType; e_targetting targetType = card.Targetting; if (rangeType == e_rangeType.Allies) { if (targetType == e_targetting.AutomaticTarget) { desc += "all allies"; } else if (targetType == e_targetting.Default) { desc += "targeted ally"; } } else if (rangeType == e_rangeType.Ennemies) { if (targetType == e_targetting.AutomaticTarget) { desc += "all ennemies"; } else if (targetType == e_targetting.Default) { desc += "targeted ennemy"; } } desc += " "; if (st.Duration > 1) { desc += "for " + st.Duration + " turns"; } if (st.Tick > 1) { desc += "per turn for " + st.Tick + " turns"; } } else if (dr != null) { desc += "Draw " + dr.Value + " card"; if (dr.Value > 1) { desc += "s"; } } desc += "\n"; } return(desc); }
public string GetEffectStat(EffectStat stat, EffectName effectName) { BuildLookup(); return(effectLookup[effectName][stat]); }