Wednesday, 20 August 2025 02:02:40
This commit is contained in:
35
Gameplay/Actions/BasicAttack.cs
Normal file
35
Gameplay/Actions/BasicAttack.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class BasicAttack : Action
|
||||
{
|
||||
public BasicAttack(Node2D OWNER) : base(OWNER)
|
||||
{
|
||||
_triggers.Add(Trigger.On.Collision);
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
if (_target != null)
|
||||
{
|
||||
if (_target is Worker)
|
||||
{
|
||||
Worker target = (Worker)_target;
|
||||
if (_owner is Worker)
|
||||
{
|
||||
Worker owner = (Worker)_owner;
|
||||
if (target._manager != owner._manager)
|
||||
{
|
||||
int damage = -owner._aptitude / 2;
|
||||
target.ChangeHealth(damage, owner);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user