Skip to content

Commit

Permalink
0.9.12-unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
uzkbwza committed Jan 8, 2023
1 parent 76bad7a commit 92c1a29
Show file tree
Hide file tree
Showing 24 changed files with 473 additions and 44 deletions.
3 changes: 2 additions & 1 deletion BottomBar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ extends VBoxContainer
func _ready():
$"%P1ActionButtons".connect("visibility_changed", self, "_on_action_buttons_visibility_changed")
$"%P2ActionButtons".connect("visibility_changed", self, "_on_action_buttons_visibility_changed")

$"%P1ActionButtons".opposite_buttons = $"%P2ActionButtons"
$"%P2ActionButtons".opposite_buttons = $"%P1ActionButtons"

func _on_action_buttons_visibility_changed():
if !$"%P1ActionButtons".visible and !$"%P2ActionButtons".visible:
Expand Down
2 changes: 1 addition & 1 deletion Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends Node

signal nag_window()

var VERSION = "0.9.11-steam"
var VERSION = "0.9.12-unstable"

var audio_player
var music_enabled = true
Expand Down
55 changes: 53 additions & 2 deletions characters/BaseChar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ signal parried()
signal undo()
signal forfeit()
signal clashed()
signal predicted()
#signal got_counter_hit()

var MAX_HEALTH = 1000
Expand All @@ -27,6 +28,8 @@ var MAX_HEALTH = 1000
const MAX_STALES = 15
const MIN_STALE_MODIFIER = "0.2"

const INCORRECT_PREDICTION_LAG = 3

const DAMAGE_SUPER_GAIN_DIVISOR = 1
const DAMAGE_TAKEN_SUPER_GAIN_DIVISOR = 3
const HITLAG_COLLISION_TICKS = 4
Expand All @@ -36,6 +39,8 @@ const BURST_ON_DAMAGE_AMOUNT = 5
const COUNTER_HIT_ADDITIONAL_HITLAG_FRAMES = 3

const MAX_GROUNDED_HITS = 7
const PREDICTION_CORRECT_SUPER_GAIN = 30


const PARRY_CHIP_DIVISOR = 3
const PARRY_KNOCKBACK_DIVISOR = "3"
Expand Down Expand Up @@ -166,6 +171,7 @@ var bursts_available: int = 0
#var parried_this_frame = false
var busy_interrupt = false
var any_available_actions = true
var refresh_prediction = false

var state_changed = false
var on_the_ground = false
Expand All @@ -183,6 +189,7 @@ var emote_tween: SceneTreeTween

var feints = 2

var current_prediction = -1

var current_nudge = {
"x": "0",
Expand Down Expand Up @@ -220,6 +227,9 @@ var aura_particle = null
var feinting = false
var clashing = false

var prediction_processed = true


var last_action = 0

var stance = "Normal"
Expand Down Expand Up @@ -290,6 +300,9 @@ func is_ivy():
return Network.network_ids[id] == SteamHustle.IVY_ID
return false

func prediction_correct():
return !is_in_hurt_state() and opponent and current_prediction == opponent.current_state().type

func apply_style(style):
if (!SteamHustle.STARTED) or Global.steam_demo_version:
return
Expand Down Expand Up @@ -358,7 +371,7 @@ func is_you():
func _ready():
sprite.animation = "Wait"
state_variables.append_array(
["current_di", "current_nudge", "clipping_wall", "has_hyper_armor", "hit_during_armor", "colliding_with_opponent", "clashing", "last_pos", "penalty", "hitstun_decay_combo_count", "touching_wall", "feinting", "feints", "lowest_tick", "is_color_active", "blocked_last_hit", "combo_proration", "state_changed","nudge_amount", "initiative_effect", "reverse_state", "combo_moves_used", "parried_last_state", "initiative", "last_vel", "last_aerial_vel", "trail_hp", "always_perfect_parry", "parried", "got_parried", "parried_this_frame", "grounded_hits_taken", "on_the_ground", "hitlag_applied", "combo_damage", "burst_enabled", "di_enabled", "turbo_mode", "infinite_resources", "one_hit_ko", "dummy_interruptable", "air_movements_left", "super_meter", "supers_available", "parried", "parried_hitboxes", "burst_meter", "bursts_available"]
["current_di", "current_nudge", "refresh_prediction", "clipping_wall", "current_prediction", "prediction_processed", "has_hyper_armor", "hit_during_armor", "colliding_with_opponent", "clashing", "last_pos", "penalty", "hitstun_decay_combo_count", "touching_wall", "feinting", "feints", "lowest_tick", "is_color_active", "blocked_last_hit", "combo_proration", "state_changed","nudge_amount", "initiative_effect", "reverse_state", "combo_moves_used", "parried_last_state", "initiative", "last_vel", "last_aerial_vel", "trail_hp", "always_perfect_parry", "parried", "got_parried", "parried_this_frame", "grounded_hits_taken", "on_the_ground", "hitlag_applied", "combo_damage", "burst_enabled", "di_enabled", "turbo_mode", "infinite_resources", "one_hit_ko", "dummy_interruptable", "air_movements_left", "super_meter", "supers_available", "parried", "parried_hitboxes", "burst_meter", "bursts_available"]
)
add_to_group("Fighter")
connect("got_hit", self, "on_got_hit")
Expand Down Expand Up @@ -552,6 +565,12 @@ func _process(delta):
reset_color()
if is_aura_active and !Global.enable_custom_particles:
reset_aura()
# $PredictionLabel.show()
# if is_ghost or ReplayManager.playback:
# $PredictionLabel.text = "State: " + str(current_state().type) + "\nPrediction: " + str(current_prediction)
# else:
# $PredictionLabel.text = ""


func debug_text():
.debug_text()
Expand Down Expand Up @@ -586,7 +605,8 @@ func launched_by(hitbox):

nudge_amount = hitbox.sdi_modifier

var will_launch = hitbox.ignore_armor or !has_armor()
var prediction_correct = opponent and current_prediction == opponent.current_state().type
var will_launch = hitbox.ignore_armor or !(has_armor() or prediction_correct())

if will_launch:
var state
Expand Down Expand Up @@ -815,6 +835,9 @@ func process_extra(extra):
feinting = extra.feint
if feinting and !infinite_resources:
feints -= 1
if "prediction" in extra:
current_prediction = extra["prediction"]
prediction_processed = false
else:
feinting = false

Expand All @@ -824,6 +847,20 @@ func refresh_air_movements():
func refresh_feints():
feints = num_feints

func process_prediction():
if current_prediction == -1:
prediction_processed = true
return
if prediction_correct():
play_sound("Predict")
play_sound("Predict2")
play_sound("Predict3")
gain_super_meter(PREDICTION_CORRECT_SUPER_GAIN)
emit_signal("predicted")
else:
hitlag_ticks += INCORRECT_PREDICTION_LAG
prediction_processed = true

func clean_parried_hitboxes():
# if is_ghost:
# return
Expand Down Expand Up @@ -854,6 +891,8 @@ func get_advantage():
# print(opponent.lowest_tick)
if state_interruptable and opponent.state_interruptable:
advantage = true
if prediction_correct():
advantage = true
if current_state().state_name == "WhiffInstantCancel" or (previous_state() and previous_state().state_name == "WhiffInstantCancel" and current_state().has_hitboxes):
advantage = false
if opponent.current_state().state_name == "WhiffInstantCancel" or (opponent.previous_state() and opponent.previous_state().state_name == "WhiffInstantCancel" and opponent.current_state().has_hitboxes):
Expand Down Expand Up @@ -914,6 +953,11 @@ func tick_before():
}
var feinted_last = feinting
var pressed_feint = false
if refresh_prediction:
refresh_prediction = false
current_prediction = -1
if !prediction_processed and !is_in_hurt_state():
process_prediction()
if queued_extra:
process_extra(queued_extra)
pressed_feint = feinting
Expand Down Expand Up @@ -950,6 +994,7 @@ func toggle_quit_graphic(on=null):
play_sound("QuitterSound")

func tick():

if hitlag_ticks > 0:
if can_nudge:
if fixed.round(fixed.mul(fixed.vec_len(current_nudge.x, current_nudge.y), "100.0")) > 1:
Expand Down Expand Up @@ -1002,6 +1047,9 @@ func tick():
last_vel = get_vel()
var pos = get_pos()

# if opponent.combo_count > 0:
# current_prediction = -1

if !is_in_hurt_state() and combo_count <= 0 and penalty_ticks <= 0:
# var dir = Utils.int_sign(last_pos.x - pos.x)
var dir = fixed.sign(last_vel.x)
Expand Down Expand Up @@ -1085,12 +1133,15 @@ func update_facing():
func on_state_interruptable(state):
if !dummy:
state_interruptable = true

else:
dummy_interruptable = true
refresh_prediction = true

func on_state_hit_cancellable(state):
if !dummy:
state_hit_cancellable = true
refresh_prediction = true

func on_action_selected(action, data, extra):
# if !state_interruptable:
Expand Down
50 changes: 44 additions & 6 deletions characters/BaseChar.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=168 format=2]
[gd_scene load_steps=171 format=2]

[ext_resource path="res://characters/BaseChar.gd" type="Script" id=1]
[ext_resource path="res://characters/stickman/sprites/idle.png" type="Texture" id=2]
Expand Down Expand Up @@ -165,6 +165,9 @@
[ext_resource path="res://characters/stickman/sprites/wall_slam.png" type="Texture" id=163]
[ext_resource path="res://sound/common/explosion5.wav" type="AudioStream" id=164]
[ext_resource path="res://fx/WallSlamEffect.tscn" type="PackedScene" id=165]
[ext_resource path="res://sound/common/predict1.wav" type="AudioStream" id=166]
[ext_resource path="res://sound/common/predict3.wav" type="AudioStream" id=167]
[ext_resource path="res://sound/common/predict2.wav" type="AudioStream" id=168]

[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
Expand Down Expand Up @@ -444,12 +447,34 @@ bus = "Fx"
script = ExtResource( 130 )
pitch_variation = 0.01

[node name="QuitterSound" type="AudioStreamPlayer2D" parent="Sounds" index="6"]
[node name="Predict" type="AudioStreamPlayer2D" parent="Sounds" index="6"]
stream = ExtResource( 166 )
volume_db = -15.0
pitch_scale = 1.5
bus = "Fx"
script = ExtResource( 130 )

[node name="Predict2" type="AudioStreamPlayer2D" parent="Sounds" index="7"]
stream = ExtResource( 168 )
volume_db = -15.0
pitch_scale = 1.5
bus = "Fx"
script = ExtResource( 130 )
pitch_variation = 0.11

[node name="Predict3" type="AudioStreamPlayer2D" parent="Sounds" index="8"]
stream = ExtResource( 167 )
volume_db = -12.0
bus = "Fx"
script = ExtResource( 130 )
pitch_variation = 0.01

[node name="QuitterSound" type="AudioStreamPlayer2D" parent="Sounds" index="9"]
stream = ExtResource( 155 )
volume_db = -20.0
bus = "Fx"

[node name="HitBass" type="AudioStreamPlayer2D" parent="Sounds" index="7"]
[node name="HitBass" type="AudioStreamPlayer2D" parent="Sounds" index="10"]
stream = ExtResource( 161 )
volume_db = -5.0
bus = "Fx"
Expand Down Expand Up @@ -1291,7 +1316,20 @@ theme = ExtResource( 47 )
text = "You"
align = 1

[node name="Node2D" type="Node2D" parent="." index="6"]
[node name="PredictionLabel" type="Label" parent="." index="6"]
visible = false
margin_left = -20.0
margin_top = -74.0
margin_right = 20.0
margin_bottom = -60.0
grow_horizontal = 2
theme = ExtResource( 47 )
text = "State:
Prediction: "
align = 1

[node name="Node2D" type="Node2D" parent="." index="7"]
visible = false
scale = Vector2( 2, 2 )
z_index = 4096

Expand All @@ -1307,7 +1345,7 @@ custom_colors/font_color = Color( 1, 0.2, 0.239216, 1 )
text = "QUITTER"
align = 1

[node name="ActionableLabel" type="Label" parent="." index="7"]
[node name="ActionableLabel" type="Label" parent="." index="8"]
visible = false
anchor_left = 0.5
anchor_right = 0.5
Expand All @@ -1319,7 +1357,7 @@ theme = ExtResource( 47 )
text = "Ready"
align = 1

[node name="EmoteLabel" type="Label" parent="." index="9"]
[node name="EmoteLabel" type="Label" parent="." index="10"]
margin_left = -141.0
margin_top = -68.0
margin_right = 141.0
Expand Down
3 changes: 2 additions & 1 deletion characters/robo/Robot.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ unique_name_in_owner = true
visible = false
position = Vector2( 0, -24 )
frames = SubResource( 7 )
frame = 1
playing = true
offset = Vector2( 0, 10 )

Expand Down Expand Up @@ -1419,6 +1418,8 @@ interrupt_from_string = "Grounded
GroundedSpecial"
interrupt_into_string = "Grounded
Aerial"
initiative_effect = true
initiative_startup_reduction_amount = 2

[node name="Hitbox" type="Node2D" parent="StateMachine/DisembowelGrab" index="0"]
z_index = 1000
Expand Down
15 changes: 10 additions & 5 deletions characters/states/CharState.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export(String) var change_stance_to = ""
export var _c_Misc = 0
export var release_opponent_on_startup = false
export var initiative_effect = false
export var initiative_startup_reduction_amount = 0
export var apply_pushback = true

var initiative_effect_spawned = false
Expand All @@ -93,6 +94,7 @@ var allowed_stances = []

var is_hurt_state = false
var start_interruptible_on_opponent_turn = false
var initiative_startup_reduction = false

func init():
connect("state_interruptable", host, "on_state_interruptable", [self])
Expand Down Expand Up @@ -183,6 +185,8 @@ func _on_hit_something(obj, hitbox):
if hitbox.cancellable:
if obj == host.opponent and obj.has_hyper_armor:
return
if obj == host.opponent and obj.prediction_correct():
return
enable_hit_cancel()

func process_hitboxes():
Expand All @@ -192,20 +196,18 @@ func process_hitboxes():
# return true
.process_hitboxes()

#func process_feint():
# return "WhiffInstantCancel"



func _tick_shared():
if current_tick == 0:
initiative_startup_reduction = false
feinting = host.feinting
hit_cancelled = false
# hit_cancelled = false
if initiative_effect and host.initiative:
if host.initiative_effect:
host.spawn_particle_effect(preload("res://fx/YomiEffect.tscn"), host.get_center_position_float())
host.initiative_effect = false
if initiative_startup_reduction_amount > 0:
initiative_startup_reduction = true

if release_opponent_on_startup:
host.release_opponent()
Expand All @@ -219,6 +221,9 @@ func _tick_shared():
host.update_data()
else:
host.reverse_state = false
if initiative_startup_reduction:
current_tick += initiative_startup_reduction_amount
initiative_startup_reduction = false
# if busy_interrupt_type != BusyInterrupt.Hurt:
# host.update_advantage()
# if host.opponent:
Expand Down
Loading

0 comments on commit 92c1a29

Please sign in to comment.