forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newcombatsystem.dm
191 lines (179 loc) · 5.5 KB
/
newcombatsystem.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
//It's not a very big change, but I think melee will benefit from it.
//Currently will only be restricted to special training weapons to test the balancedness of the system.
//1)Knockdown, stun and weaken chances are separate and dependant on the part of the body you're aiming at
//eg a mop will be better applied to legs since it has a higher base knockdown chance than the other disabling states
//while an energy gun would be better applied to the chest because of the stunning chance.
//2)Weapons also have a parry chance which is checked every time the one wielding the weapon is attacked in melee
//in the area is currently aiming at and is able to defend himself.
//More ideas to come.
//NOTES: doesn't work with armor yet
/obj/item/weapon/training //subclass of weapons that is currently the only one that uses the alternate combat system
name = "training weapon"
desc = "A weapon for training the advanced fighting technicues"
var/chance_parry = 0
var/chance_weaken = 0
var/chance_stun = 0
var/chance_knockdown = 0
var/chance_knockout = 0
var/chance_disarm = 0
//chances - 5 is low, 10 is medium, 15 is good
/obj/item/weapon/training/axe //hard-hitting, but doesn't have much in terms of disabling people (except by killing)
name = "training axe"
icon_state = "training_axe"
/*combat stats*/
force = 15
chance_parry = 5
chance_weaken = 10
chance_stun = 5
chance_knockdown = 5
chance_knockout = 5
chance_disarm = 0
/obj/item/weapon/training/sword //not bad attack, good at parrying and disarming
name = "training sword"
icon_state = "training_sword"
/*combat stats*/
force = 10
chance_parry = 15
chance_weaken = 5
chance_stun = 0
chance_knockdown = 5
chance_knockout = 0
chance_disarm = 15
/obj/item/weapon/training/staff //not bad attack either, good at tripping and parrying
name = "training staff"
icon_state = "training_staff"
/*combat stats*/
force = 10
chance_parry = 15
chance_weaken = 5
chance_stun = 0
chance_knockdown = 15
chance_knockout = 0
chance_disarm = 5
/obj/item/weapon/training/mace //worst attack, but has a good chance of stun, knockout or weaken
name = "training mace"
icon_state = "training_mace"
/*combat stats*/
force = 5
chance_parry = 0
chance_weaken = 15
chance_stun = 10
chance_knockdown = 0
chance_knockout = 10
chance_disarm = 0
/obj/item/weapon/training/attack(target as mob, mob/user as mob)
var/target_area = attack_location(user.zone_sel.selecting)
for(var/mob/O in viewers(src,7))
O << "\red \b [user.name] attacks [target.name] in the [target_area] with [src.name]!"
if(!target.stat && target.zone_sel.selecting == target_area) //parrying occurs here
if(istype(target.r_hand,/obj/item/weapon/training)
if(prob(target.r_hand:chance_parry))
for(var/mob/O in viewers(src,7))
O << "\red \b [target.name] deftly parries the attack with [target.r_hand.name]!"
return
if(istype(target.l_hand,/obj/item/weapon/training)
if(prob(target.l_hand:chance_parry))
for(var/mob/O in viewers(src,7))
O << "\red \b [target.name] deftly parries the attack with [target.l_hand.name]!"
return
target.adjustBruteLoss(-src.force)
var/modifier_knockdown = 1.0
var/modifier_knockout = 1.0
var/modifier_stun = 1.0
var/modifier_weaken = 1.0
var/modifier_disarm = 0.0
switch(target_area)
if("eyes")
modifier_weaken = 2.0
modifier_stun = 0.5
modifier_knockdown = 0.0
if("head")
modifier_stun = 0.8
modifier_knockout = 1.5
modifier_weaken = 1.2
modifier_knockdown = 0.0
if("chest")
if("right arm","r_arm")
if("left arm","l_arm")
if("right hand","r_hand")
if("left hand","l_hand")
if("groin")
if("right leg","r_leg")
if("left leg","l_leg")
if("right foot","r_foot")
if("left foot","l_foot")
/proc/attack_location(var/initloc = "chest") //proc to randomise actual hit loc based on where you're aiming at
var/resultloc = "chest" //also forgot hands/feet. bleh
var/percentage = rand(1,100)
switch(initloc)
if("eyes")
switch(percentage)
if(1 to 10)
resultloc = "eyes"
if(11 to 30)
resultloc = "head"
if(31 to 100)
resultloc = "chest"
if("head")
switch(percentage)
if(1 to 5)
resultloc = "eyes"
if(6 to 40)
resultloc = "head"
if(41 to 100)
resultloc = "chest"
if("chest")
switch(percentage)
if(1 to 80)
resultloc = "chest"
if(81 to 84)
resultloc = "right arm"
if(85 to 88)
resultloc = "left arm"
if(89 to 92)
resultloc = "right leg"
if(93 to 96)
resultloc = "left leg"
if(97 to 98)
resultloc = "groin"
if(99 to 100)
resultloc = "head"
if("l_arm")
switch(percentage)
if(1 to 60)
resultloc = "left arm"
if(61 to 100)
resultloc = "chest"
if("r_arm")
switch(percentage)
if(1 to 60)
resultloc = "right arm"
if(61 to 100)
resultloc = "chest"
if("groin")
switch(percentage)
if(1 to 35)
resultloc = "groin"
if(36 to 50)
resultloc = "left leg"
if(51 to 65)
resultloc = "right leg"
if(66 to 100)
resultloc = "chest"
if("l_leg")
switch(percentage)
if(1 to 60)
resultloc = "left leg"
if(61 to 70)
resultloc = "groin"
if(71 to 100)
resultloc = "chest"
if("r_leg")
switch(percentage)
if(1 to 60)
resultloc = "right leg"
if(61 to 70)
resultloc = "groin"
if(71 to 100)
resultloc = "chest"
return resultloc