damage calculation (wip)

This commit is contained in:
Page Asgardius 2024-05-15 15:51:17 -07:00
parent 02ab2a38e9
commit dc061b2dea
9 changed files with 122 additions and 34 deletions

View file

@ -3,6 +3,8 @@ var velocity: Vector2 = Vector2()
var direction
var speciality
var btype
var attack
var crit
# Called when the node enters the scene tree for the first time.
func _ready():
if is_in_group("players"):
@ -22,6 +24,17 @@ func _on_body_entered(body):if !body.is_in_group(btype):
if body.is_in_group("players") || body.is_in_group("boss") || body.is_in_group("enemies"):
if body.weakness == speciality:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack * crit
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack * crit
else:
Input.start_joy_vibration(0,1,0,2)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack
#if body.is_in_group("players"):
# Global.live = 2
#elif body.is_in_group("enemies"):

View file

@ -5,6 +5,8 @@ var speciality
var speed = 100
var btype
var isvisible
var attack
var crit
# Called when the node enters the scene tree for the first time.
func _ready():
if is_in_group("players"):
@ -36,8 +38,16 @@ func _on_body_entered(body):
if body.weakness == speciality:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack * crit
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack * crit
else:
Input.start_joy_vibration(0,1,0,2)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack
elif body.is_in_group("boss") || body.is_in_group("enemies"):
if body.weakness == speciality:
print("weakness")

View file

@ -4,6 +4,8 @@ var direction
var speed = 100
var btype
var isvisible
var attack
var crit
# Called when the node enters the scene tree for the first time.
func _ready():
isvisible = $VisibleOnScreenNotifier2D
@ -29,8 +31,16 @@ func _on_body_entered(body):
if body.weakness == 3:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack * crit
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack * crit
else:
Input.start_joy_vibration(0,1,0,2)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack
elif body.is_in_group("boss") || body.is_in_group("enemies"):
if body.weakness == 3:
print("weakness")

View file

@ -4,6 +4,8 @@ var direction
var speed = 100
var btype
var isvisible
var attack
var crit
# Called when the node enters the scene tree for the first time.
func _ready():
isvisible = $VisibleOnScreenNotifier2D
@ -29,8 +31,16 @@ func _on_body_entered(body):
if body.weakness == 0:
print("weakness")
Input.start_joy_vibration(0,0,1,3)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack * crit
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack * crit
else:
Input.start_joy_vibration(0,1,0,2)
if Global.debug:
Global.dstats[Global.dparty[Global.dcpchar][0]][0] -= attack
else:
Global.dstats[Global.party[Global.cpchar][0]][0] -= attack
elif body.is_in_group("boss") || body.is_in_group("enemies"):
if body.weakness == 0:
print("weakness")

View file

@ -11,9 +11,13 @@ var vangle = 2
var weakness = 1
var movex = 0
var movey = 0
var attack = 59
var crit = 5
func _ready():
if Global.isboss:
Global.cboss = ["Kimberly Arch",0,0]
var stimer = $Speed
stimer.start(0.05)
@ -86,6 +90,8 @@ func shoot(angle):
new_bullet.position = Vector2(position.x, position.y)
new_bullet.direction = get_vector(angle)
new_bullet.btype = "boss"
new_bullet.attack = attack
new_bullet.crit = crit
get_parent().call_deferred("add_child",new_bullet)

View file

@ -12,9 +12,13 @@ var weakness = 2
var player
var movex = 0
var movey = 0
var attack = 87
var crit = 7
func _ready():
if Global.isboss:
Global.cboss = ["Natasha Dostoyevsky",20520,20520]
var stimer = $Speed
stimer.start(0.05)
#player = get_parent().root.get_node("Player")
@ -88,6 +92,8 @@ func shoot(angle):
new_bullet.position = Vector2(position.x, position.y)
new_bullet.direction = get_vector(angle)
new_bullet.btype = "boss"
new_bullet.attack = attack
new_bullet.crit = crit
get_parent().call_deferred("add_child",new_bullet)