using Godot; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; public partial class Player : Actor { public bool _isTurn = false; public string _name; public Phone _phone; public Boss _boss; public Enemy _activeEnemy; public RichTextLabel _debug; public List _businessCards; public override void _Ready() { base._Ready(); _debug = GetNode("Debug"); _phone = GetNode("Phone"); _phone.PassPlayer(this); _boss = GetNode("Boss"); _boss.PassPlayer(this); _businessCards = GetChildren().Where(c=>c is BusinessCard).Cast().ToList(); for (int i = 0; i < _businessCards.Count; i++) { _businessCards[i].PassPlayer(this); _businessCards[i].AssignGoal(GoalName.MiddleColumn); } Challenge(_boss); } public void Challenge(Enemy ENEMY) { _board?.Deactivate(); ENEMY._board.Activate(); _board = ENEMY._board; _activeEnemy = ENEMY; CheckBusinessCards(); string text = ""; if (_activeEnemy is Mook) { text = "dragon " + _activeEnemy._owner._number + "\nmook " + _activeEnemy._number; } else if (_activeEnemy is Dragon) { text = "dragon " + _activeEnemy._number; } _debug.Text = text; } public void CheckBusinessCards() { _businessCards.ForEach(b=>b.CheckGoal()); } // public bool CheckWin(List CELLS) // { // foreach (Goal.GoalName cond in _goal._eligibleGoals) // { // foreach (List condList in _goal._conditions[cond]) // { // // if (condList.All(a=>CELLS.FirstOrDefault(c=>c._address == a, null)?._owner == this)) // // { // // return true; // // } // } // } // return false; // } // public void MarkCell(Cell CELL) // { // CELL._mark.Texture = _mark.Texture; // // CELL._owner = this; // } public override void _Process(double delta) { if (Input.IsActionJustReleased("backspace")) { if (_board._owner._owner != null) { Challenge(_board._owner._owner); } } } }