Saturday, 31 January 2026 01:00:43

This commit is contained in:
2026-01-31 01:00:45 -05:00
parent d9d33f9758
commit 672e91d381
38 changed files with 374 additions and 424 deletions

BIN
Art/broken_shield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5oc4f3gxijq5"
path="res://.godot/imported/broken_shield.png-18bca4dc3aa93b7e622d775255883827.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Art/broken_shield.png"
dest_files=["res://.godot/imported/broken_shield.png-18bca4dc3aa93b7e622d775255883827.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Art/reg_shield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

40
Art/reg_shield.png.import Normal file
View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3agkku8rqvmj"
path="res://.godot/imported/reg_shield.png-707495a71352fd3f05b6fd7cddacd9a5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Art/reg_shield.png"
dest_files=["res://.godot/imported/reg_shield.png-707495a71352fd3f05b6fd7cddacd9a5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

12
Gameplay/Action.cs Normal file
View File

@@ -0,0 +1,12 @@
using Godot;
using System;
public partial class Action : Node
{
public float _timerSeconds, _cooldownSeconds;
public Actor _owner;
public virtual void Fire()
{
}
}

1
Gameplay/Action.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://cac8dbhhcrjfe

View File

@@ -0,0 +1,25 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
public partial class Example1 : Action
{
public override void _Ready()
{
base._Ready();
}
public override void Fire()
{
base.Fire();
// GD.Print(_owner);
List<Shield> unbrokenShields = [.. _owner._board._shields.Where(s=>!s._broken)];
int shieldNumber = Globals._rng.Next(0, unbrokenShields.Count);
int damageAmount = Globals._rng.Next(-12,-8);
_owner._board._shields[shieldNumber].ChangeHealth(damageAmount);
((Player)_owner)._phone._debug.Text = "Shield " + shieldNumber + " damaged " + damageAmount + "hp";
}
}

View File

@@ -0,0 +1 @@
uid://bgl77ljlxm6xf

View File

@@ -17,204 +17,5 @@ public partial class Actor : Sprite2D
_markDisabled = GetNode<Sprite2D>("MarkDisabled");
_markFocused = GetNode<Sprite2D>("MarkFocused");
}
// CALLABLE ACTIONS
public bool RotateCells(int ROTATIONS = 1)
{
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
List<int> addresses = new(_board._cells.Select(c=>c._address).ToList());
Dictionary<int, int> cwShifts = new()
{
{0,1}, {1,2}, {2,5}, {3,0}, {4,4}, {5,8}, {6,3}, {7,6}, {8,7}
};
Dictionary<int, int> ccwShifts = new()
{
{0,3}, {1,0}, {2,1}, {3,6}, {4,4}, {5,2}, {6,7}, {7,8}, {8,5}
};
Dictionary<int, int> shifts = ROTATIONS > 0 ? cwShifts : ccwShifts;
for (int i = 0; i < Math.Abs(ROTATIONS); i++)
{
for (int j = 0; j < addresses.Count; j++)
{
int address = addresses[j];
int newAddress = shifts[address];
addresses[j] = newAddress;
}
}
for (int i = 0; i < _board._cells.Count; i++)
{
int newCellAddress = addresses[i];
_board._cells[i].Position = positions[newCellAddress];
}
_board.RenumberCells();
return true;
}
public bool RotateMarks(int ROTATIONS = 1)
{
List<Cell> cells = new(_board._cells);
List<int> addresses = new(_board._cells.Select(c=>c._address).ToList());
Dictionary<int, int> cwShifts = new()
{
{0,1}, {1,2}, {2,5}, {3,0}, {4,4}, {5,8}, {6,3}, {7,6}, {8,7}
};
Dictionary<int, int> ccwShifts = new()
{
{0,3}, {1,0}, {2,1}, {3,6}, {4,4}, {5,2}, {6,7}, {7,8}, {8,5}
};
Dictionary<int, int> shifts = ROTATIONS > 0 ? cwShifts : ccwShifts;
for (int i = 0; i < Math.Abs(ROTATIONS); i++)
{
for (int j = 0; j < addresses.Count; j++)
{
int address = addresses[j];
int newAddress = shifts[address];
addresses[j] = newAddress;
}
}
for (int i = 0; i < _board._cells.Count; i++)
{
int newCellAddress = addresses[i];
_board._cells[i].Mark(cells[newCellAddress]._marker);
}
return true;
}
public bool ShuffleCells()
{
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
Globals.Shuffle(positions);
for (int i = 0; i < _board._cells.Count; i++)
{
_board._cells[i].Position = positions[i];
}
_board.RenumberCells();
return true;
}
public bool ShuffleMarks()
{
List<Cell> cells = new(_board._cells);
Globals.Shuffle(cells);
for (int i = 0; i < _board._cells.Count; i++)
{
_board._cells[i].Mark(cells[i]._marker);
}
return true;
}
public bool ShiftCells(int SHIFT_ROWS_BY = 0,int SHIFT_COLUMNS_BY = 0)
{
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
int[,] addressTable = {{0,1,2},{3,4,5},{6,7,8}};
List<int> rows = new(){0,1,2};
List<int> columns = new(){0,1,2};
rows = Globals.ShiftList(rows, SHIFT_ROWS_BY);
columns = Globals.ShiftList(columns, SHIFT_COLUMNS_BY);
for (int i = 0; i < rows.Count; i++)
{
for (int j = 0; j < columns.Count; j++)
{
_board._cells[addressTable[rows[i],columns[j]]].Position = positions[addressTable[i,j]];
}
}
return true;
}
public bool ShiftMarks(int SHIFT_ROWS_BY = 0,int SHIFT_COLUMNS_BY = 0)
{
List<Actor> markers = new(_board._cells.Select(c=>c._marker).ToList());
int[,] addressTable = {{0,1,2},{3,4,5},{6,7,8}};
List<int> rows = new(){0,1,2};
List<int> columns = new(){0,1,2};
rows = Globals.ShiftList(rows, SHIFT_ROWS_BY);
columns = Globals.ShiftList(columns, SHIFT_COLUMNS_BY);
for (int i = 0; i < rows.Count; i++)
{
for (int j = 0; j < columns.Count; j++)
{
_board._cells[addressTable[rows[i],columns[j]]].Mark(markers[addressTable[i,j]]);
}
}
return true;
}
public bool SlideCells(int SHIFT_SPOTS = 1)
{
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
int start = SHIFT_SPOTS > 0 ? 0 : 9;
for (int i = 0; i < _board._cells.Count; i++)
{
int newSpot = (start + i + SHIFT_SPOTS) % 9;
_board._cells[i].Position = positions[newSpot];
}
_board.RenumberCells();
return true;
}
public bool SlideMarks(int SHIFT_SPOTS = 1)
{
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
int start = SHIFT_SPOTS > 0 ? 0 : 9;
for (int i = 0; i < _board._cells.Count; i++)
{
int newSpot = (start + i + SHIFT_SPOTS) % 9;
_board._cells[i].Position = positions[newSpot];
}
_board.RenumberCells();
return true;
}
public bool SwapCells(int CELL_A_ADDRESS = -1, int CELL_B_ADDRESS = -1)
{
if (CELL_A_ADDRESS < -1 || CELL_A_ADDRESS > 8 || CELL_B_ADDRESS < -1 || CELL_B_ADDRESS > 8 || CELL_A_ADDRESS == CELL_B_ADDRESS)
{
return false;
}
List<Vector2> positions = new(_board._cells.Select(c=>c.Position).ToList());
if (CELL_A_ADDRESS == -1)
{
CELL_A_ADDRESS = Globals._rng.Next(0,8);
while (CELL_A_ADDRESS == CELL_B_ADDRESS)
{
CELL_A_ADDRESS = Globals._rng.Next(0,8);
}
}
if (CELL_B_ADDRESS == -1)
{
CELL_B_ADDRESS = Globals._rng.Next(0,8);
while (CELL_B_ADDRESS == CELL_A_ADDRESS)
{
CELL_B_ADDRESS = Globals._rng.Next(0,8);
}
}
_board._cells[CELL_A_ADDRESS].Position = positions[CELL_B_ADDRESS];
_board._cells[CELL_B_ADDRESS].Position = positions[CELL_A_ADDRESS];
_board.RenumberCells();
return true;
}
//MoveMark
}

View File

@@ -2,22 +2,33 @@ using Godot;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.Serialization;
public partial class Board : Sprite2D
{
public bool _active = false, _moveMade = false, _won = false;
public List<Cell> _cells = new();
public List<Shield> _shields = new();
public Enemy _owner;
public Actor _winner = null;
public GoalName _winningPattern;
public override void _Ready()
{
_cells = GetChildren().Where(c=>c is Cell).Cast<Cell>().ToList();
for (int i = 0; i < _cells.Count; i++)
_shields = GetChildren().Where(c=>c is Shield).Cast<Shield>().ToList();
int xSize = (int)Texture.GetSize().X;
int ySize = (int)Texture.GetSize().Y;
for (int i = 0; i < _shields.Count; i++)
{
_cells[i]._address = i;
_shields[i]._address = i;
float shieldX = _shields[i].TextureNormal.GetSize().X;
float shieldY = _shields[i].TextureNormal.GetSize().Y;
_shields[i].Scale = new Vector2(shieldX / (xSize/3), shieldY / (ySize/3));
int c = i % 3 - 1;
int r = (int)(i/3) - 1;
_shields[i].Position = new Vector2(xSize / 3f * c - shieldX / 2, ySize / 3f * r - shieldY / 2);
}
}
@@ -45,14 +56,14 @@ public partial class Board : Sprite2D
public void ClaimOwnership(Enemy OWNER)
{
_owner = OWNER;
_cells.ForEach(c=>c._owner = OWNER);
_cells.ForEach(c=>c._board = this);
_shields.ForEach(c=>c._owner = OWNER);
_shields.ForEach(c=>c._board = this);
}
public void ClearBoard(){
foreach (Cell cell in _cells)
foreach (Shield shield in _shields)
{
cell.Mark();
// shield.Mark();
}
}
@@ -61,19 +72,19 @@ public partial class Board : Sprite2D
Disable(true);
}
public Cell GetCellByTenant(Enemy TENANT)
public Shield GetShieldByTenant(Enemy TENANT)
{
return _cells.Single(c=>c._tenant == TENANT);
return _shields.Single(c=>c._tenant == TENANT);
}
public Cell GetCellByAddress(int ADDRESS)
public Shield GetShieldByAddress(int ADDRESS)
{
return _cells.Single(c=>c._address == ADDRESS);
return _shields.Single(c=>c._address == ADDRESS);
}
public List<Cell> GetCellsByOwner(Actor ACTOR)
public List<Shield> GetShieldsByOwner(Actor ACTOR)
{
return _cells.Where(c=>c._marker == ACTOR).ToList();
return _shields.Where(c=>c._marker == ACTOR).ToList();
}
//THIS SHOULD BE MOVED INTO ACTION LOGIC
@@ -82,17 +93,17 @@ public partial class Board : Sprite2D
// for (int i = 0; i < REPEAT; i++)
// {
// Rotation += DEGREES * ((float)Math.PI / 180);
// RenumberCells();
// RenumberShields();
// }
// }
public void RenumberCells()
public void RenumberShields()
{
_cells = _cells.OrderBy(c => c.Position.Y).ThenBy(c => c.Position.X).ToList();
_shields = _shields.OrderBy(c => c.Position.Y).ThenBy(c => c.Position.X).ToList();
for (int i = 0; i < _cells.Count; i++)
for (int i = 0; i < _shields.Count; i++)
{
_cells[i]._address = i;
_shields[i]._address = i;
}
}
@@ -108,6 +119,6 @@ public partial class Board : Sprite2D
_active = !DISABLED;
Visible = !DISABLED;
SetProcess(!DISABLED);
_cells.ForEach(c=>c.Disable(DISABLED));
_shields.ForEach(c=>c.Disable(DISABLED));
}
}

View File

@@ -15,8 +15,8 @@ public partial class Boss : Enemy
for (int i = 0; i < _dragons.Count; i++)
{
_dragons[i]._owner = this;
_dragons[i]._number = _board._cells[i]._address;
_board._cells[i]._tenant = _dragons[i];
_dragons[i]._number = _board._shields[i]._address;
_board._shields[i]._tenant = _dragons[i];
}
}
@@ -26,9 +26,9 @@ public partial class Boss : Enemy
_dragons.ForEach(d=>d.PassPlayer(PLAYER));
}
public override void ClickCell(Cell CLICKED_CELL)
public override void ClickShield(Shield CLICKED_SHIELD)
{
_playerOpponent.Challenge(CLICKED_CELL._tenant);
_playerOpponent.Challenge(CLICKED_SHIELD._tenant);
}
}

View File

@@ -40,12 +40,11 @@ public partial class BusinessCard : TextureButton
public void CheckGoal()
{
List<Cell> ownedCells = _player._board.GetCellsByOwner(_player);
List<Shield> ownedShields = _player._board.GetShieldsByOwner(_player);
List<int> addresses = _goal.GetAddresses(_goalName);
_goalMet = addresses.All(a=>ownedCells.Select(c=>c._address).ToList().IndexOf(a)>-1);
_goalMet = addresses.All(a=>ownedShields.Select(c=>c._address).ToList().IndexOf(a)>-1);
if (_goalMet)
{
GD.Print(_goalName);
Modulate = new Color(1,1,1,1);
}
else

View File

@@ -14,6 +14,6 @@ public partial class CallButton : TextureButton
public override void _Pressed()
{
base._Pressed();
_phone.CallLoadedContact();
_phone._player.StartBattle();
}
}

View File

@@ -1,46 +0,0 @@
using Godot;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
public partial class Cell : TextureButton
{
public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false;
public int _address;
public Enemy _owner, _tenant;
public Actor _marker;
public Sprite2D _defaultMark;
public Board _board;
public override void _Ready()
{
_defaultMark = GetNode<Sprite2D>("DefaultMark");
}
public override void _Pressed()
{
base._Pressed();
_owner.ClickCell(this);
}
public override void _Process(double DELTA)
{
base._Process(DELTA);
}
public void Disable(bool DISABLED)
{
SetProcess(!DISABLED);
}
public void Mark(Actor MARKER = null)
{
_marker = MARKER;
TextureNormal = (MARKER == null ? _defaultMark : MARKER._markNormal).Texture;
TexturePressed = (MARKER == null ? _defaultMark : MARKER._markPressed).Texture;
TextureHover = (MARKER == null ? _defaultMark : MARKER._markHovered).Texture;
TextureDisabled = (MARKER == null ? _defaultMark : MARKER._markDisabled).Texture;
TextureFocused = (MARKER == null ? _defaultMark : MARKER._markFocused).Texture;
}
}

View File

@@ -1,27 +1,73 @@
using Godot;
using System;
using System.Runtime.CompilerServices;
public partial class Contact : Sprite2D
{
public Player _player;
public int _number;
public bool _clickable, _interval;
public int _number, _calls = 0, _maxCalls = 0;
public Timer _timer, _cooldown;
public Action _action;
public Actor _owner;
public override void _Ready()
{
_timer = GetNode<Timer>("Timer");
_cooldown = GetNode<Timer>("Cooldown");
_action = GetNode<Action>("Action");
}
public virtual void CallAction()
{
if (_cooldown.TimeLeft > 0 || _action._cooldownSeconds == 0)
{
GD.Print("Action fired!!");
_action.Fire();
}
}
public void PassNumber(int NUMBER)
{
_number = NUMBER;
}
public void PassPlayer(Player PLAYER)
public void PassOwner(Actor OWNER)
{
_player = PLAYER;
_owner = OWNER;
_action._owner = OWNER;
}
public void SetTimer(float SECONDS)
{
_action._timerSeconds = SECONDS;
}
public void SetCooldown(int SECONDS)
{
_action._cooldownSeconds = SECONDS;
}
public void Start()
{
// GD.Print(_action._timerSeconds);
if (_action._timerSeconds > 0)
{
_timer.Start(_action._timerSeconds);
_calls = 0;
}
}
private void OnTimerTimeout()
{
if (_calls <= _maxCalls || _maxCalls == 0)
{
CallAction();
_timer.Start(_action._timerSeconds);
_calls++;
}
}
private void OnCooldownTimeout()
{
}
}

View File

@@ -1,7 +0,0 @@
public partial class Rotate90 : Contact
{
public override void CallAction()
{
_player.RotateCells(2);
}
}

View File

@@ -1 +0,0 @@
uid://dtv3bqpuf0y33

View File

@@ -1,7 +0,0 @@
public partial class Shift1ColumnRight : Contact
{
public override void CallAction()
{
_player.ShiftCells(0,1);
}
}

View File

@@ -1 +0,0 @@
uid://ciphg323a14cs

View File

@@ -1,7 +0,0 @@
public partial class ShuffleCells : Contact
{
public override void CallAction()
{
_player.ShuffleCells();
}
}

View File

@@ -1 +0,0 @@
uid://dshwao6it1ltt

View File

@@ -1,7 +0,0 @@
public partial class SlideBack2 : Contact
{
public override void CallAction()
{
_player.SlideCells(-2);
}
}

View File

@@ -1 +0,0 @@
uid://c14om0rrrui02

View File

@@ -1,7 +0,0 @@
public partial class Swap1And6 : Contact
{
public override void CallAction()
{
_player.SwapCells(1-1,6-1);
}
}

View File

@@ -1 +0,0 @@
uid://bl37rkfpucd5e

View File

@@ -9,7 +9,7 @@ public partial class Dragon : Enemy
// public Board _board;
public List<Mook> _mooks;
// public Player _playerOpponent;
// public Cell _cell;
// public Shield _shield;
public override void _Ready()
{
@@ -18,8 +18,8 @@ public partial class Dragon : Enemy
for (int i = 0; i < _mooks.Count; i++)
{
_mooks[i]._owner = this;
_mooks[i]._number = _board._cells[i]._address;
_board._cells[i]._tenant = _mooks[i];
_mooks[i]._number = _board._shields[i]._address;
_board._shields[i]._tenant = _mooks[i];
}
}
@@ -35,8 +35,8 @@ public partial class Dragon : Enemy
}
public override void ClickCell(Cell CLICKED_CELL)
public override void ClickShield(Shield CLICKED_SHIELD)
{
_playerOpponent.Challenge(CLICKED_CELL._tenant);
_playerOpponent.Challenge(CLICKED_SHIELD._tenant);
}
}

View File

@@ -7,7 +7,7 @@ public partial class Enemy : Actor
{
public int _number;
public Player _playerOpponent;
public Cell _cell;
public Shield _shield;
public Enemy _owner;
public List<GoalName> _defaultGoals = new();
public List<GoalName> _goals = new();
@@ -36,13 +36,13 @@ public partial class Enemy : Actor
public void CheckGoals()
{
List<Cell> ownedCells = _board.GetCellsByOwner(this);
List<Shield> ownedShields = _board.GetShieldsByOwner(this);
Goal goal = new Goal();
for (int i = 0; i < _defaultGoals.Count; i++)
{
GoalName goalName = _defaultGoals[i];
List<int> addresses = goal.GetAddresses(goalName);
bool goalMet = addresses.All(a=>ownedCells.Select(c=>c._address).ToList().IndexOf(a)>-1);
bool goalMet = addresses.All(a=>ownedShields.Select(c=>c._address).ToList().IndexOf(a)>-1);
if (goalMet)
{
Victory(goalName);
@@ -51,7 +51,7 @@ public partial class Enemy : Actor
}
}
public virtual void ClickCell(Cell CLICKED_CELL)
public virtual void ClickShield(Shield CLICKED_SHIELD)
{
}
@@ -61,7 +61,7 @@ public partial class Enemy : Actor
_board._winningPattern = WINNING_PATTERN;
if (_owner != null)
{
_owner._board.GetCellByTenant(this).Mark(_playerOpponent);
// _owner._board.GetShieldByTenant(this).Mark(_playerOpponent);
}
else
{
@@ -74,7 +74,7 @@ public partial class Enemy : Actor
_board._winningPattern = WINNING_PATTERN;
if (_owner != null)
{
_owner._board.GetCellByTenant(this).Mark(this);
_owner._board.GetShieldByTenant(this).Break();
}
else
{

View File

@@ -12,9 +12,9 @@ public partial class Mook : Enemy
}
public override void ClickCell(Cell CLICKED_CELL)
public override void ClickShield(Shield CLICKED_SHIELD)
{
CLICKED_CELL.Mark(_playerOpponent);
// CLICKED_SHIELD.Mark(_playerOpponent);
_playerOpponent.CheckGoals();
}
}

View File

@@ -21,11 +21,9 @@ public partial class Phone : Sprite2D
{
_phoneButtons[i]._phone = this;
}
_phoneButtons[0]._contact = new SlideBack2();
_phoneButtons[1]._contact = new Rotate90();
_phoneButtons[2]._contact = new Swap1And6();
_phoneButtons[3]._contact = new Shift1ColumnRight();
_phoneButtons[4]._contact = new ShuffleCells();
_phoneButtons[0]._contact._action = new Example1();
_phoneButtons[0]._contact._action._owner = _player;
_phoneButtons[0]._contact.SetTimer(1.5f);
}
public override void _Process(double DELTA_)
@@ -33,17 +31,17 @@ public partial class Phone : Sprite2D
// _hoveredButton = _phoneButtons.FirstOrDefault(c => c._isHovered, null);
}
public void CallLoadedContact()
{
_loadedContact.CallAction();
ResetContact();
}
// public void CallLoadedContact()
// {
// _loadedContact.CallAction();
// ResetContact();
// }
public void LoadContact(Contact CONTACT)
{
_loadedContact = CONTACT;
_debug.Text = _loadedContact.GetType().ToString();
}
// public void LoadContact(Contact CONTACT)
// {
// _loadedContact = CONTACT;
// _debug.Text = _loadedContact.GetType().ToString();
// }
public void PassPlayer(Player PLAYER)
{
@@ -51,7 +49,7 @@ public partial class Phone : Sprite2D
for (int i = 0; i < _phoneButtons.Count; i++)
{
_phoneButtons[i]._phone = this;
_phoneButtons[i]._contact.PassPlayer(PLAYER);
_phoneButtons[i]._contact.PassOwner(PLAYER);
_phoneButtons[i]._contact.PassNumber((i+1)%10);
}
}

View File

@@ -4,7 +4,7 @@ using System;
public partial class PhoneButton : TextureButton
{
// [Signal]
// public delegate void HoverEventHandler(Cell THISCELL, bool ISHOVERED);
// public delegate void HoverEventHandler(Shield THISSHIELD, bool ISHOVERED);
public bool _isHovered = false;
public Phone _phone;
public Contact _contact;
@@ -18,7 +18,10 @@ public partial class PhoneButton : TextureButton
public override void _Pressed()
{
base._Pressed();
_phone.LoadContact(_contact);
if (_contact._clickable)
{
_contact.CallAction();
}
}

View File

@@ -82,13 +82,21 @@ public partial class Player : Actor
_debug.Text = "YOU WIN!!";
}
// public bool CheckWin(List<Cell> CELLS)
public void StartBattle()
{
for (int i = 0; i < _phone._phoneButtons.Count; i++)
{
_phone._phoneButtons[i]._contact.Start();
}
}
// public bool CheckWin(List<Shield> SHIELDS)
// {
// foreach (Goal.GoalName cond in _goal._eligibleGoals)
// {
// foreach (List<int> condList in _goal._conditions[cond])
// {
// // if (condList.All(a=>CELLS.FirstOrDefault<Cell>(c=>c._address == a, null)?._owner == this))
// // if (condList.All(a=>SHIELDS.FirstOrDefault<Shield>(c=>c._address == a, null)?._owner == this))
// // {
// // return true;
// // }
@@ -96,10 +104,10 @@ public partial class Player : Actor
// }
// return false;
// }
// public void MarkCell(Cell CELL)
// public void MarkShield(Shield SHIELD)
// {
// CELL._mark.Texture = _mark.Texture;
// // CELL._owner = this;
// SHIELD._mark.Texture = _mark.Texture;
// // SHIELD._owner = this;
// }
public override void _Process(double delta)

66
Gameplay/Shield.cs Normal file
View File

@@ -0,0 +1,66 @@
using Godot;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
public partial class Shield : TextureButton
{
public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false, _broken = false;
public int _address, _durability;
public Enemy _owner, _tenant;
public Actor _marker;
public Sprite2D _regularMark, _brokenMark;
public Board _board;
public override void _Ready()
{
_regularMark = GetNode<Sprite2D>("RegularMark");
_brokenMark = GetNode<Sprite2D>("BrokenMark");
_durability = 100;
}
public override void _Pressed()
{
base._Pressed();
_owner.ClickShield(this);
}
public override void _Process(double DELTA)
{
base._Process(DELTA);
}
public void Break()
{
_broken = true;
TextureNormal = TexturePressed = TextureHover = TextureDisabled = TextureFocused = _brokenMark.Texture;
}
public void ChangeHealth(int CHANGE_AMOUNT)
{
_durability += CHANGE_AMOUNT;
if (!_broken)
{
if (_durability <= 0)
{
Break();
}
}
}
public void Disable(bool DISABLED)
{
SetProcess(!DISABLED);
}
// public void Mark(Actor MARKER = null)
// {
// _marker = MARKER;
// TextureNormal = (MARKER == null ? _defaultMark : MARKER._markNormal).Texture;
// TexturePressed = (MARKER == null ? _defaultMark : MARKER._markPressed).Texture;
// TextureHover = (MARKER == null ? _defaultMark : MARKER._markHovered).Texture;
// TextureDisabled = (MARKER == null ? _defaultMark : MARKER._markDisabled).Texture;
// TextureFocused = (MARKER == null ? _defaultMark : MARKER._markFocused).Texture;
// }
}

6
Gameplay/action.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://fygidhjkgabe"]
[ext_resource type="Script" uid="uid://cac8dbhhcrjfe" path="res://Gameplay/Action.cs" id="1_lk435"]
[node name="Action" type="Node" unique_id=110922950]
script = ExtResource("1_lk435")

View File

@@ -1,63 +1,27 @@
[gd_scene load_steps=4 format=3 uid="uid://jkmo1fb2ohv4"]
[gd_scene format=3 uid="uid://jkmo1fb2ohv4"]
[ext_resource type="Texture2D" uid="uid://cbi83mc26qju5" path="res://Art/Tic-tac-toe.png" id="1_iqk8r"]
[ext_resource type="Script" uid="uid://decakbqo4jfdi" path="res://Gameplay/Board.cs" id="2_ucn0m"]
[ext_resource type="PackedScene" uid="uid://0vj01cjcpibt" path="res://Gameplay/cell.tscn" id="3_s74v7"]
[ext_resource type="PackedScene" uid="uid://b32djog2mowgw" path="res://Gameplay/shield.tscn" id="3_ucn0m"]
[node name="Board" type="Sprite2D"]
[node name="Board" type="Sprite2D" unique_id=816918439]
texture = ExtResource("1_iqk8r")
script = ExtResource("2_ucn0m")
[node name="Cell1" parent="." instance=ExtResource("3_s74v7")]
offset_left = -300.0
offset_top = -301.0
offset_right = -100.0
offset_bottom = -101.0
[node name="Shield0" parent="." unique_id=1408990258 instance=ExtResource("3_ucn0m")]
[node name="Cell2" parent="." instance=ExtResource("3_s74v7")]
offset_left = -100.0
offset_top = -300.0
offset_right = 100.0
offset_bottom = -100.0
[node name="Shield1" parent="." unique_id=1099937150 instance=ExtResource("3_ucn0m")]
[node name="Cell3" parent="." instance=ExtResource("3_s74v7")]
offset_left = 100.0
offset_top = -300.0
offset_right = 300.0
offset_bottom = -100.0
[node name="Shield2" parent="." unique_id=555260924 instance=ExtResource("3_ucn0m")]
[node name="Cell4" parent="." instance=ExtResource("3_s74v7")]
offset_left = -300.0
offset_top = -100.0
offset_right = -100.0
offset_bottom = 100.0
[node name="Shield3" parent="." unique_id=1428089072 instance=ExtResource("3_ucn0m")]
[node name="Cell5" parent="." instance=ExtResource("3_s74v7")]
offset_left = -100.0
offset_top = -100.0
offset_right = 100.0
offset_bottom = 100.0
[node name="Shield4" parent="." unique_id=1268807490 instance=ExtResource("3_ucn0m")]
[node name="Cell6" parent="." instance=ExtResource("3_s74v7")]
offset_left = 100.0
offset_top = -100.0
offset_right = 300.0
offset_bottom = 100.0
[node name="Shield5" parent="." unique_id=646412611 instance=ExtResource("3_ucn0m")]
[node name="Cell7" parent="." instance=ExtResource("3_s74v7")]
offset_left = -300.0
offset_top = 100.0
offset_right = -100.0
offset_bottom = 300.0
[node name="Shield6" parent="." unique_id=1387360377 instance=ExtResource("3_ucn0m")]
[node name="Cell8" parent="." instance=ExtResource("3_s74v7")]
offset_left = -100.0
offset_top = 100.0
offset_right = 100.0
offset_bottom = 300.0
[node name="Shield7" parent="." unique_id=949001958 instance=ExtResource("3_ucn0m")]
[node name="Cell9" parent="." instance=ExtResource("3_s74v7")]
offset_left = 100.0
offset_top = 100.0
offset_right = 300.0
offset_bottom = 300.0
[node name="Shield8" parent="." unique_id=1837156402 instance=ExtResource("3_ucn0m")]

View File

@@ -1,19 +0,0 @@
[gd_scene format=3 uid="uid://0vj01cjcpibt"]
[ext_resource type="Script" uid="uid://pg7mpir3ewhw" path="res://Gameplay/Cell.cs" id="1_lehgd"]
[ext_resource type="Texture2D" uid="uid://g6ikqlh8yccy" path="res://Art/blanksquare.jpg" id="2_mxyjk"]
[node name="Cell" type="TextureButton" unique_id=1408990258]
modulate = Color(1, 1, 1, 0.2)
offset_right = 200.0
offset_bottom = 200.0
texture_normal = ExtResource("2_mxyjk")
texture_pressed = ExtResource("2_mxyjk")
texture_hover = ExtResource("2_mxyjk")
texture_disabled = ExtResource("2_mxyjk")
texture_focused = ExtResource("2_mxyjk")
script = ExtResource("1_lehgd")
[node name="DefaultMark" type="Sprite2D" parent="." unique_id=1684344431]
visible = false
texture = ExtResource("2_mxyjk")

View File

@@ -1,6 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://if21pf73w7by"]
[gd_scene format=3 uid="uid://if21pf73w7by"]
[ext_resource type="Script" uid="uid://bgj2cuqdq0b6l" path="res://Gameplay/Contact.cs" id="1_basqx"]
[ext_resource type="PackedScene" uid="uid://fygidhjkgabe" path="res://Gameplay/action.tscn" id="2_dg7ct"]
[node name="Contact" type="Sprite2D"]
[node name="Contact" type="Sprite2D" unique_id=1143036413]
script = ExtResource("1_basqx")
[node name="Timer" type="Timer" parent="." unique_id=879173975]
[node name="Cooldown" type="Timer" parent="." unique_id=1276257080]
[node name="Action" parent="." unique_id=110922950 instance=ExtResource("2_dg7ct")]
[connection signal="timeout" from="Timer" to="." method="OnTimerTimeout"]
[connection signal="timeout" from="Cooldown" to="." method="OnCooldownTimeout"]

24
Gameplay/shield.tscn Normal file
View File

@@ -0,0 +1,24 @@
[gd_scene format=3 uid="uid://b32djog2mowgw"]
[ext_resource type="Texture2D" uid="uid://3agkku8rqvmj" path="res://Art/reg_shield.png" id="1_j8jvf"]
[ext_resource type="Script" uid="uid://pg7mpir3ewhw" path="res://Gameplay/Shield.cs" id="2_53x4r"]
[ext_resource type="Texture2D" uid="uid://b5oc4f3gxijq5" path="res://Art/broken_shield.png" id="3_tgx6c"]
[node name="Shield" type="TextureButton" unique_id=1408990258]
modulate = Color(1, 1, 1, 0.2)
offset_right = 200.0
offset_bottom = 200.0
texture_normal = ExtResource("1_j8jvf")
texture_pressed = ExtResource("1_j8jvf")
texture_hover = ExtResource("1_j8jvf")
texture_disabled = ExtResource("1_j8jvf")
texture_focused = ExtResource("1_j8jvf")
script = ExtResource("2_53x4r")
[node name="RegularMark" type="Sprite2D" parent="." unique_id=1684344431]
visible = false
texture = ExtResource("1_j8jvf")
[node name="BrokenMark" type="Sprite2D" parent="." unique_id=1605725110]
visible = false
texture = ExtResource("3_tgx6c")