Skip to content

Commit

Permalink
Add ORIGINAL_GAME_BUG and ORIGINAL_GAME_DEVIATION
Browse files Browse the repository at this point in the history
Tags in comments, to be able to quickly check all original game bugs
\ and deviations from original game behavior
  • Loading branch information
Kvel2D committed Oct 3, 2024
1 parent 9711788 commit 779285c
Show file tree
Hide file tree
Showing 93 changed files with 395 additions and 343 deletions.
8 changes: 7 additions & 1 deletion src/buffs/aura.gd
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,17 @@ func _on_manual_timer_timeout():

var active_buff: Buff = unit.get_buff_of_type(_aura_effect)

# NOTE: if there's an active buff and it's from a
# NOTE: If there's an active buff and it's from a
# tower of same family but lower tier - remove it.
# This is to always prio auras from higher tier
# towers. Doesn't affect buffs defined outside tower
# scripts, in items for example.
#
# [ORIGINAL_GAME_DEVIATION] The mechanic of comparing
# tower tiers didn't exist in original game. Aura
# which was entered first would stay on the creep,
# even if creep entered a stronger version of same
# aura.
#
# NOTE: this code section needs to be duplicated from
# BuffType._do_stacking_behavior() because for auras
Expand Down
5 changes: 5 additions & 0 deletions src/buffs/buff_type.gd
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ func disable_stacking_behavior():
# NOTE: the stacking logic has to be in the exact way as
# defined here. Changing this logic will break tower and
# item scripts.
#
# [ORIGINAL_GAME_DEVIATION] The comparison of tower tiers
# didn't exist in original game. If lower tier tower applied
# a buff and a higher tier tower tried to overwrite it, the
# buff from higher tier tower would get rejected.
func _do_stacking_behavior(target: Unit, new_level: int):
var active_buff: Buff = target.get_buff_of_type(self)

Expand Down
13 changes: 12 additions & 1 deletion src/buffs/instances/cb_stun.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ extends BuffType

# NOTE: analog of globally available cb_stun in JASS

# NOTE: [ORIGINAL_GAME_DEVIATION] In original game, stuns
# cannot stack. If you have two towers try to apply two
# different variations of stuns, then one will cancel
# another. In original game, total duration of stun will be
# time before cancel + duration of cancelling buff. In
# youtd2, both stuns will be applied and total duration will
# be equal to the max of durations of two stuns.


# These values calibrate diminishing returns for stuns on
# creeps. Stuns will start to randomly cancel after the
Expand Down Expand Up @@ -35,7 +43,10 @@ func on_create(event: Event):
target.add_stun()


# This function implements Diminishing Returns for stuns.
# NOTE: [ORIGINAL_GAME_DEVIATION] Implemented Diminishing
# Returns. Original game didn't have explicit Diminishing
# Returns for stuns but it may have inherited some hidden
# functionality from wc3 engine.
func periodic(event: Event):
var buff: Buff = event.get_buff()
var target = buff.get_buffed_unit()
Expand Down
5 changes: 3 additions & 2 deletions src/builders/instances/builder_maverick.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
extends Builder


# NOTE: the following builder effect from original game is
# not implemented: "Unable to share build areas with allies"
# NOTE: [ORIGINAL_GAME_DEVIATION] the following builder
# effect from original game is not implemented: "Unable to
# share build areas with allies"


func _init():
Expand Down
15 changes: 8 additions & 7 deletions src/creeps/special_buffs/creep_necromancer.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
class_name CreepNecromancer extends BuffType


# NOTE: in original game, Necromancers raise skeletons.
# Don't have sprites for skeletons so raising creeps using
# their original sprites.

# NOTE: original script appears to set health of revived
# creep to double of the original amount. Not sure if this
# is correct? Left at 100% of original health for now.
# NOTE: [ORIGINAL_GAME_DEVIATION] in original game,
# Necromancers raise skeletons. Don't have sprites for
# skeletons so raising creeps using their original sprites.

# NOTE: [ORIGINAL_GAME_DEVIATION] original script
# appears to set health of revived creep to double of the
# original amount. Not sure if this is correct? Left at 100%
# of original health for now.


const RAISE_DELAY: float = 2
Expand Down
6 changes: 6 additions & 0 deletions src/enums/attack_type.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
class_name AttackType extends Node


# NOTE: [ORIGINAL_GAME_DEVIATION] renamed "Magic"
# attack type from original game to "Arcane". Original
# "Magic" name for attack type was confusing because it
# sounded like it was related to "spell damage".

enum enm {
PHYSICAL,
DECAY,
Expand Down
7 changes: 4 additions & 3 deletions src/items/item_behaviors/bhaals_essence.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
extends ItemBehavior


# NOTE: fixed an error in original script. Slow modifier
# wasn't added to aura effect type.
# NOTE: [ORIGINAL_GAME_BUG] Fixed bug where slow debuff
# wasn't attached to aura. This caused the item to not slow
# the creeps.


# thanks to Gex "ice core" aura
var fright_bt: BuffType


Expand Down
4 changes: 2 additions & 2 deletions src/items/item_behaviors/flag_of_the_allegiance.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends ItemBehavior

# NOTE: this item was named "Flag of the Alliance" in
# original youtd
# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Flag of the Alliance"=>"Flag of the Allegiance"

var motivation_bt: BuffType

Expand Down
6 changes: 4 additions & 2 deletions src/items/item_behaviors/hippogryph_egg.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
extends ItemBehavior


# NOTE: fixed bug in original script where it used incorrect
# order of args for do_spell_damage_aoe()
# NOTE: [ORIGINAL_GAME_BUG] Fixed bug where
# do_spell_damage_aoe() received args in incorrect order.
# "crit_ratio" and "sides_ratio" were swapped. This caused
# the damage from this item to always crit.


var hippo_pt: ProjectileType
Expand Down
7 changes: 4 additions & 3 deletions src/items/item_behaviors/jewels_of_the_moon.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
extends ItemBehavior


# NOTE: changed this item to remove day/night mechanic.
# Original script gives 2 during day and 4 at night, so
# average it down to 3.
# NOTE: [ORIGINAL_GAME_DEVIATION] Day/night mechanic is not
# implemented so changed this item effect to be average
# between day and night. Original script gives 2 during day
# and 4 at night, so average it down to 3.


# Original description:
Expand Down
10 changes: 5 additions & 5 deletions src/items/item_behaviors/mefis_rocket.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
extends ItemBehavior


# NOTE: changed the 2nd "one_shot" arg passed to
# enable_advanced(). Original script passes "true" but this
# causes the tower to not fire projectiles in youtd2 engine.
# Not sure if the JASS engine processes the "one_shot" arg
# in some weird way.
# NOTE: [ORIGINAL_GAME_DEVIATION] changed the 2nd "one_shot"
# arg passed to enable_advanced(). Original script passes
# "true" but this causes the tower to not fire projectiles
# in youtd2 engine. Not sure if the JASS engine processes
# the "one_shot" arg in some weird way.


var rocket_pt: ProjectileType
Expand Down
3 changes: 2 additions & 1 deletion src/items/item_behaviors/mini_forest_troll.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extends ItemBehavior


# NOTE: this item was named "Mini Furbolg" in original youtd
# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Mini Furbolg"=>"Mini Forest Troll"


var rampage_bt: BuffType
Expand Down
4 changes: 3 additions & 1 deletion src/items/item_behaviors/morgul_slave.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extends ItemBehavior

# NOTE: this item was named "Mur'gul Slave" in original youtd

# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Mur'gul Slave"=>"Morgul Slave"


func load_modifier(modifier: Modifier):
Expand Down
1 change: 0 additions & 1 deletion src/items/item_behaviors/oil_of_magic.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Oil of Magic
extends ItemBehavior


Expand Down
6 changes: 0 additions & 6 deletions src/items/item_behaviors/periscope.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
extends ItemBehavior


# NOTE: changed rarity of this item. Original rarity was
# uncommon, changed to common. Original rarity didn't make
# sense because this item is weaker than common rarity "Ring
# of Luck" item.


func load_modifier(modifier: Modifier):
modifier.add_modification(Modification.Type.MOD_TRIGGER_CHANCES, 0.05, 0.0)
4 changes: 3 additions & 1 deletion src/items/item_behaviors/sages_mask.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extends ItemBehavior

# NOTE: this item was named "Sobi Mask" in original youtd

# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Sobi Mask"=>"Sage's Mask"


func load_modifier(modifier: Modifier):
Expand Down
7 changes: 4 additions & 3 deletions src/items/item_behaviors/staff_of_the_wild_equus.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
extends ItemBehavior


# NOTE: original script moves lifted creeps a little by
# random offset. Removed it because youtd2 creeps are
# supposed to always be "on rails", on creep path.
# NOTE: [ORIGINAL_GAME_DEVIATION] Original script moves
# lifted creeps a little by random offset. Removed it
# because youtd2 creeps are supposed to always be "on
# rails", on creep path.


var ascended_bt: BuffType
Expand Down
1 change: 0 additions & 1 deletion src/items/item_behaviors/undead_spiked_claws.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Undead Spiked Claws
extends ItemBehavior


Expand Down
16 changes: 8 additions & 8 deletions src/items/item_behaviors/unyielding_maul.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends ItemBehavior


# NOTE: original script implemented miss effect via "attack"
# event. Not sure how that's supposed to work because
# setting event.damage to 0 in attack event should have no
# effect. At least it has no effect in the godot engine, so
# I changed to this script to use "damage" event. Maybe it
# does work in JASS engine that way, need to test this item
# in original game and change how attack event is handled in
# godot engine if needed.
# NOTE: [ORIGINAL_GAME_DEVIATION] original script
# implemented miss effect via "attack" event. Not sure how
# that's supposed to work because setting event.damage to 0
# in attack event should have no effect. At least it has no
# effect in the godot engine, so I changed to this script to
# use "damage" event. Maybe it does work in JASS engine that
# way, need to test this item in original game and change
# how attack event is handled in godot engine if needed.


func get_ability_description() -> String:
Expand Down
1 change: 0 additions & 1 deletion src/items/item_behaviors/wanted_list.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Wanted List
extends ItemBehavior


Expand Down
5 changes: 3 additions & 2 deletions src/items/item_behaviors/war_drum.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extends ItemBehavior

# NOTE: this item was named "Warsong Double Bass" in
# original youtd
# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Warsong Double Bass"=>"War Drum"


var drum_bt: BuffType

Expand Down
9 changes: 5 additions & 4 deletions src/singletons/constants.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ const IRL_SECONDS_TO_GAME_WORLD_HOURS: float = 24.0 / 480.0
const INITIAL_TIME_OF_DAY: float = 12.0


# NOTE: there was no damage max in original game. This is
# just an arbitrary number to protect against bugs. Note
# that it can't be lower than this because creep hp can go
# up to billions in bonus waves.
# NOTE: [ORIGINAL_GAME_DEVIATION] there was no damage
# max in original game. This is just an arbitrary number to
# protect against bugs. Note that it can't be lower than
# this because creep hp can go up to billions in bonus
# waves.
const DAMAGE_MIN: float = 0
const DAMAGE_MAX: float = 1000000000000

Expand Down
12 changes: 8 additions & 4 deletions src/towers/tower_behaviors/ash_geyser.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
extends TowerBehavior


# NOTE: fixed bug in original script where lower tier tower
# could temporarily reduce damage of the Ignite. This
# happened because DAMAGE callback always changed user_real
# without checking if it's a downgrade.
# NOTE: [ORIGINAL_GAME_DEVIATION] Changed behavior when
# multiple copies of this tower try to apply Ignite buff on
# same unit.
#
# Original game: lower tier tower could temporarily reduce
# damage of Ignite.
#
# YouTD2: Lower tier tower can't reduce damage of Ignite.


var ignite_bt: BuffType
Expand Down
5 changes: 3 additions & 2 deletions src/towers/tower_behaviors/astral_lantern.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
extends TowerBehavior


# NOTE: commented out sections relevant to invisibility
# because invisible waves are currently disabled.
# NOTE: [ORIGINAL_GAME_DEVIATION] Commented out sections
# relevant to invisibility because invisible waves are not
# implemented.


# func get_tier_stats() -> Dictionary:
Expand Down
5 changes: 0 additions & 5 deletions src/towers/tower_behaviors/astral_rift.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
extends TowerBehavior


# NOTE: original script appears to have a bug where it
# doesn't check if tower has enough mana to do rift ability.
# So it will spend 20 mana and do nothing. Fixed it.


var aura_bt: BuffType
var slow_bt: BuffType

Expand Down
3 changes: 2 additions & 1 deletion src/towers/tower_behaviors/baby_tuskin.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extends TowerBehavior


# NOTE: this tower was named "Tuskar" in original youtd
# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Baby Tuskar"=>"Baby Tuskin"


var snowball_pt: ProjectileType
Expand Down
15 changes: 7 additions & 8 deletions src/towers/tower_behaviors/black_dragon_roost.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
extends TowerBehavior


# NOTE: original script appears to be completely broken? It
# uses addEventOnDamage() which means that the handler will
# be called when creep *deals damage* and that's clearly not
# what's supposed to happen. Might be only a typo on
# youtd.best website. Fixed it by switching to
# addEventOnDamaged()/add_event_on_damaged() so that the
# handler which increases damage take by creep is called
# when creep takes damage.
# NOTE: [ORIGINAL_GAME_BUG] Original script appears to be
# completely broken? It uses addEventOnDamage() which means
# that the handler will be called when creep *deals damage*
# and that's clearly not what's supposed to happen. Fixed it
# by switching to addEventOnDamaged()/add_event_on_damaged()
# so that the handler which increases damage taken by creep
# is called when creep takes damage.

# NOTE: the trigger chance for Fear the Dark ability appears
# to have been changed often. Used 20% which is the value on
Expand Down
4 changes: 2 additions & 2 deletions src/towers/tower_behaviors/black_rock_totem.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extends TowerBehavior


# NOTE: this tower was named "Blackrock's Totem" in original
# youtd
# NOTE: [ORIGINAL_GAME_DEVIATION] Renamed
# "Blackrock's Totem"=>"Black Rock Totem"


var fighter_totem_bt: BuffType
Expand Down
5 changes: 1 addition & 4 deletions src/towers/tower_behaviors/bonk_the_living_mountain.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
extends TowerBehavior


# NOTE: changed values for growth scale a bit.


# NOTE: SCALE_MIN should match the value in tower sprite
# NOTE: SCALE_MIN must match the value in tower sprite
# scene
const SCALE_MIN: float = 0.5
const SCALE_MAX: float = 1.0
Expand Down
Loading

0 comments on commit 779285c

Please sign in to comment.