Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes to battle arcade #2893

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions code/game/machinery/computer/arcade/battle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
if(isnull(battle_arcade_gear_list))
var/list/all_gear = list()
for(var/datum/battle_arcade_gear/template as anything in subtypesof(/datum/battle_arcade_gear))
if(!(template::slot)) //needs to fit in something.
continue
all_gear[template::name] = new template
battle_arcade_gear_list = all_gear

Expand Down Expand Up @@ -216,7 +218,7 @@
message_admins("[ADMIN_LOOKUPFLW(usr)] has outbombed Cuban Pete and been awarded a bomb.")
usr.log_message("outbombed Cuban Pete and has been awarded a bomb.", LOG_GAME)
else
to_chat(user, span_notice("[src] dispenses 2 tickets!"))
visible_message(span_notice("[src] dispenses 2 tickets!"))
new /obj/item/stack/arcadeticket((get_turf(src)), 2)
player_gold += enemy_gold_reward
if(user)
Expand Down Expand Up @@ -282,12 +284,14 @@
process_enemy_turn(user)

///Called when you successfully counterattack the enemy.
/obj/machinery/computer/arcade/battle/proc/successful_counterattack()
/obj/machinery/computer/arcade/battle/proc/successful_counterattack(mob/user)
var/datum/battle_arcade_gear/weapon = equipped_gear[WEAPON_SLOT]
var/damage_dealt = (rand(20, 30) * (!isnull(weapon) ? weapon.bonus_modifier : 1))
enemy_hp -= round(max(0, damage_dealt), 1)
feedback_message = "User counterattacked for [damage_dealt] damage!"
playsound(loc, 'sound/arcade/boom.ogg', 40, TRUE, extrarange = -3)
if(enemy_hp <= 0)
on_battle_win(user)
SStgui.update_uis(src)

///Handles the delay between the user's and enemy's turns to process what's going on.
Expand Down Expand Up @@ -346,7 +350,7 @@
var/chance_at_counterattack = 40 + (skill_level * 5) //at level 1 this is 45, at legendary this is 75
var/damage_dealt = (defending_flags & BATTLE_ATTACK_FLAG_DEFEND) ? rand(5, 10) : rand(15, 20)
if((defending_flags & BATTLE_ATTACK_FLAG_COUNTERATTACK) && prob(chance_at_counterattack))
return successful_counterattack()
return successful_counterattack(user)
return user_take_damage(user, damage_dealt)

/obj/machinery/computer/arcade/battle/ui_data(mob/user)
Expand Down
21 changes: 17 additions & 4 deletions code/game/machinery/computer/arcade/battle_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///The name of the gear, used in shops.
var/name = "Gear"
///The slot this gear fits into
var/slot = WEAPON_SLOT
var/slot
///The world the player has to be at in order to buy this item.
var/world_available
///The stat given by the gear
Expand Down Expand Up @@ -95,19 +95,32 @@
bonus_modifier = 4

/datum/battle_arcade_gear/tier_7/armor
name = "Celestial Armor"
name = "Ethereal Armor"
slot = ARMOR_SLOT
bonus_modifier = 4

/datum/battle_arcade_gear/tier_8
world_available = BATTLE_WORLD_EIGHT

/datum/battle_arcade_gear/tier_8/weapon
name = "Gungnir"
slot = WEAPON_SLOT
bonus_modifier = 4.5

/datum/battle_arcade_gear/tier_8/armor
name = "Celestial Armor"
slot = ARMOR_SLOT
bonus_modifier = 4.5

/datum/battle_arcade_gear/tier_9
world_available = BATTLE_WORLD_NINE

/datum/battle_arcade_gear/tier_9/weapon
name = "Mjolnir"
slot = WEAPON_SLOT
bonus_modifier = 5

/datum/battle_arcade_gear/tier_8/armor
name = "Ethereal Armor"
/datum/battle_arcade_gear/tier_9/armor
name = "Void Armor"
slot = ARMOR_SLOT
bonus_modifier = 5
Loading