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, _busDebug; public List _businessCards; public override void _Ready() { base._Ready(); _debug = GetNode("Debug"); _busDebug = GetNode("BusDebug"); _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); if (_businessCards[i].Name.ToString().IndexOf("Default") > -1) { string goalNameString = _businessCards[i].Name.ToString().Replace("Default","").Replace("Alt",""); GoalName goalName; Enum.TryParse(goalNameString, out goalName); _businessCards[i].AssignGoal(goalName); } else { _businessCards[i].AssignRandomGoal(); } } Challenge(_boss); } public void Challenge(Enemy ENEMY) { _board?.Deactivate(); ENEMY._board.Activate(); _board = ENEMY._board; _activeEnemy = ENEMY; CheckGoals(); 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 CheckGoals() { _businessCards.ForEach(b=>b.CheckGoal()); } public void RunLost() { _debug.Text = "YOU LOSE!!"; } public void RunWon() { _debug.Text = "YOU WIN!!"; } public void StartBattle() { for (int i = 0; i < _phone._phoneButtons.Count; i++) { _phone._phoneButtons[i]._contact.Start(); } } // public bool CheckWin(List SHIELDS) // { // foreach (Goal.GoalName cond in _goal._eligibleGoals) // { // foreach (List condList in _goal._conditions[cond]) // { // // if (condList.All(a=>SHIELDS.FirstOrDefault(c=>c._address == a, null)?._owner == this)) // // { // // return true; // // } // } // } // return false; // } // public void MarkShield(Shield SHIELD) // { // SHIELD._mark.Texture = _mark.Texture; // // SHIELD._owner = this; // } public override void _Process(double delta) { if (Input.IsActionJustReleased("backspace")) { if (_board._owner._owner != null) { Challenge(_board._owner._owner); } } } }