Files
Polaris/code/game/objects/items/weapons/material/twohanded.dm
2017-02-24 18:51:44 -06:00

145 lines
4.6 KiB
Plaintext

/* Two-handed Weapons
* Contains:
* Twohanded
* Fireaxe
* Double-Bladed Energy Swords
*/
/*##################################################################
##################### TWO HANDED WEAPONS BE HERE~ -Agouri :3 ########
####################################################################*/
//Rewrote TwoHanded weapons stuff and put it all here. Just copypasta fireaxe to make new ones ~Carn
//This rewrite means we don't have two variables for EVERY item which are used only by a few weapons.
//It also tidies stuff up elsewhere.
/*
* Twohanded
*/
/obj/item/weapon/material/twohanded
w_class = ITEMSIZE_LARGE
var/wielded = 0
var/force_wielded = 0
var/force_unwielded
var/wieldsound = null
var/unwieldsound = null
var/base_icon
var/base_name
var/unwielded_force_divisor = 0.25
/obj/item/weapon/material/twohanded/update_held_icon()
var/mob/living/M = loc
if(istype(M) && !issmall(M) && M.item_is_in_hands(src) && !M.hands_are_full())
wielded = 1
force = force_wielded
name = "[base_name] (wielded)"
update_icon()
else
wielded = 0
force = force_unwielded
name = "[base_name]"
update_icon()
..()
/obj/item/weapon/material/twohanded/update_force()
base_name = name
if(sharp || edge)
force_wielded = material.get_edge_damage()
else
force_wielded = material.get_blunt_damage()
force_wielded = round(force_wielded*force_divisor)
force_unwielded = round(force_wielded*unwielded_force_divisor)
force = force_unwielded
throwforce = round(force*thrown_force_divisor)
//world << "[src] has unwielded force [force_unwielded], wielded force [force_wielded] and throwforce [throwforce] when made from default material [material.name]"
/obj/item/weapon/material/twohanded/New()
..()
update_icon()
//Allow a small chance of parrying melee attacks when wielded - maybe generalize this to other weapons someday
/obj/item/weapon/material/twohanded/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
if(wielded && default_parry_check(user, attacker, damage_source) && prob(15))
user.visible_message("<span class='danger'>\The [user] parries [attack_text] with \the [src]!</span>")
playsound(user.loc, 'sound/weapons/punchmiss.ogg', 50, 1)
return 1
return 0
/obj/item/weapon/material/twohanded/update_icon()
icon_state = "[base_icon][wielded]"
item_state = icon_state
/obj/item/weapon/material/twohanded/dropped()
..()
if(wielded)
spawn(0)
update_held_icon()
/*
* Fireaxe
*/
/obj/item/weapon/material/twohanded/fireaxe // DEM AXES MAN, marker -Agouri
icon_state = "fireaxe0"
base_icon = "fireaxe"
name = "fire axe"
desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?"
unwielded_force_divisor = 0.25
force_divisor = 0.7 // 10/42 with hardness 60 (steel) and 0.25 unwielded divisor
dulled_divisor = 0.75 //Still metal on a stick
sharp = 1
edge = 1
w_class = ITEMSIZE_LARGE
slot_flags = SLOT_BACK
force_wielded = 30
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
applies_material_colour = 0
/obj/item/weapon/material/twohanded/fireaxe/update_held_icon()
var/mob/living/M = loc
if(istype(M) && !issmall(M) && M.item_is_in_hands(src) && !M.hands_are_full())
wielded = 1
pry = 1
force = force_wielded
name = "[base_name] (wielded)"
update_icon()
else
wielded = 0
pry = 0
force = force_unwielded
name = "[base_name]"
update_icon()
..()
/obj/item/weapon/material/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity)
if(!proximity) return
..()
if(A && wielded)
if(istype(A,/obj/structure/window))
var/obj/structure/window/W = A
W.shatter()
else if(istype(A,/obj/structure/grille))
qdel(A)
else if(istype(A,/obj/effect/plant))
var/obj/effect/plant/P = A
P.die_off()
//spears, bay edition
/obj/item/weapon/material/twohanded/spear
icon_state = "spearglass0"
base_icon = "spearglass"
name = "spear"
desc = "A haphazardly-constructed yet still deadly weapon of ancient design."
force = 10
w_class = ITEMSIZE_LARGE
slot_flags = SLOT_BACK
force_divisor = 0.75 // 22 when wielded with hardness 15 (glass)
unwielded_force_divisor = 0.375
thrown_force_divisor = 1.5 // 20 when thrown with weight 15 (glass)
throw_speed = 3
edge = 0
sharp = 1
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "poked", "jabbed", "torn", "gored")
default_material = "glass"
applies_material_colour = 0
fragile = 1 //It's a haphazard thing of glass, wire, and steel