Gun-Kata: Path of the Antag (#10677)

This commit is contained in:
Geeves
2020-12-05 13:48:58 +02:00
committed by GitHub
parent 0da00aa525
commit 131ad8a522
9 changed files with 44 additions and 10 deletions

View File

@@ -16,3 +16,8 @@
item_cost = 5
path = /obj/item/martial_manual/swordsmanship
/datum/uplink_item/item/martial_arts/gun_kata
name = "Gun-Kata"
desc = "A manual containing basic Gun-Kata instruction and techniques. This is for projectile weapons, allowing you to reload by using a gun on a magazine, and automatically ejecting the magazine when it's empty."
item_cost = 4
path = /obj/item/martial_manual/gun_kata

View File

@@ -0,0 +1,10 @@
/datum/martial_art/gun_kata
name = "Gun-Kata"
weapon_affinity = list(/obj/item/gun)
/obj/item/martial_manual/gun_kata
name = "Gun-Kata manual"
desc = "A manual containing basic Gun-Kata instruction and techniques."
icon_state = "rulebook"
item_state = "rulebook"
martial_art = /datum/martial_art/gun_kata

View File

@@ -8,7 +8,7 @@
var/no_guns = FALSE //set to TRUE to prevent users of this style from using guns
var/no_guns_message = "" //message to tell the style user if they try and use a gun while no_guns = TRUE (DISHONORABRU!)
var/temporary = 0
var/weapon_affinity //if this martial art has any interaction with a weapon, also spawns said weapon when the manual is used
var/list/weapon_affinity //if this martial art has any interaction with a weapon
var/parry_multiplier = 1 //if this martial art increases the chance of parrying with the weapon
var/list/possible_weapons //if any weapon is spawned when you use the martial art manual

View File

@@ -1,6 +1,6 @@
/datum/martial_art/swordsmanship
name = "Swordsmanship"
weapon_affinity = /obj/item/material/sword
weapon_affinity = list(/obj/item/material/sword)
parry_multiplier = 2
possible_weapons = list(/obj/item/material/sword, /obj/item/material/sword/katana, /obj/item/material/sword/rapier)

View File

@@ -233,11 +233,12 @@
var/parry_bonus = 0
for(var/art in known_martial_arts)
var/datum/martial_art/M = art
if(istype(O, M.weapon_affinity))
if(parry_chance)
parry_bonus = max(parry_bonus, M.parry_multiplier)
continue
return TRUE
for(var/type in M.weapon_affinity)
if(istype(O, type))
if(parry_chance)
parry_bonus = max(parry_bonus, M.parry_multiplier)
continue
return TRUE
if(parry_chance)
return parry_bonus
return FALSE

View File

@@ -139,6 +139,10 @@
C.forceMove(src)
stored_ammo.Insert(1, C) //add to the head of the list
update_icon()
else if(istype(W, /obj/item/gun) && ishuman(user))
var/mob/living/carbon/human/H = user
if(H.check_weapon_affinity(W)) // if we have gun-kata, we can reload by attacking a magazine
W.attackby(src, user)
/obj/item/ammo_magazine/attack_self(mob/user)
if(!stored_ammo.len)

View File

@@ -66,11 +66,15 @@
return chambered.BB
return null
/obj/item/gun/projectile/handle_post_fire()
/obj/item/gun/projectile/handle_post_fire(mob/user)
..()
if(chambered)
chambered.expend()
process_chambered()
if(ammo_magazine && !length(ammo_magazine.stored_ammo) && ishuman(user))
var/mob/living/carbon/human/H = user
if(H.check_weapon_affinity(src))
unload_ammo(user, TRUE, TRUE)
update_maptext()
/obj/item/gun/projectile/handle_click_empty()
@@ -173,9 +177,12 @@
update_icon()
//attempts to unload src. If allow_dump is set to 0, the speedloader unloading method will be disabled
/obj/item/gun/projectile/proc/unload_ammo(mob/user, var/allow_dump = 1)
/obj/item/gun/projectile/proc/unload_ammo(mob/user, var/allow_dump = 1, var/drop_mag = FALSE)
if(ammo_magazine)
user.put_in_hands(ammo_magazine)
if(drop_mag)
ammo_magazine.forceMove(user.loc)
else
user.put_in_hands(ammo_magazine)
user.visible_message("[user] removes [ammo_magazine] from [src].", "<span class='notice'>You remove [ammo_magazine] from [src].</span>")
playsound(src.loc, ammo_magazine.eject_sound, 50, FALSE)
ammo_magazine.update_icon()