Browse Source

Fixed several Timer related bugs. Added ability to override name on NPC in case you want to use multiples of the same kind. Added randomized portraits for several NPC types. Made several NPC type slightly randomized in Stats. Added Initiative (Timer) to Stats Print.

KeyMasterOfGozer 4 years ago
parent
commit
251720770a
2 changed files with 115 additions and 79 deletions
  1. 36 25
      locations/fight.qsrc
  2. 79 54
      locations/fight_npcdata.qsrc

+ 36 - 25
locations/fight.qsrc

@@ -169,11 +169,11 @@ if $ARGS[0] = 'applyDamage':
 		!!If the target has clones, destroy one
 		if <<$fightAppDam['TargetType']>>_clone[<<fightAppDam['TargetNumber']>>] > 0:
 			<<$fightAppDam['TargetType']>>_clone[<<fightAppDam['TargetNumber']>>] -= 1
-			""<<$fightAppDam['TargetName']>> losses a clone.""
+			""<<$fightAppDam['TargetName']>> loses a clone.""
 		!!if the target has enough shields to mitigate, remove some shields
 		elseif <<$fightAppDam['TargetType']>>_shield[<<fightAppDam['TargetNumber']>>] >= <<fightAppDam['Damage']>>:
 			<<$fightAppDam['TargetType']>>_shield[<<fightAppDam['TargetNumber']>>] -= <<fightAppDam['Damage']>>
-			""<<$fightAppDam['TargetName']>> losses <<fightAppDam['Damage']>> defense.""
+			""<<$fightAppDam['TargetName']>> loses <<fightAppDam['Damage']>> defense.""
 		!!otherwise remove shields to 0 and the remainder comes from health
 		else
 			if <<$fightAppDam['TargetType']>>_shield[<<fightAppDam['TargetNumber']>>] > 0:
@@ -185,7 +185,7 @@ if $ARGS[0] = 'applyDamage':
 			else
 				<<$fightAppDam['TargetType']>>_health[<<fightAppDam['TargetNumber']>>] = 0
 			end
-			""<<$fightAppDam['TargetName']>> losses <<fightAppDam['OverShieldDamage']>> health.""
+			""<<$fightAppDam['TargetName']>> loses <<fightAppDam['OverShieldDamage']>> health.""
 		end
 	"
 	killvar '$fightAppDam'
@@ -302,7 +302,6 @@ if $ARGS[0] = 'findActiveTimer':
 		i += 1
 		jump 'LowTimerLoop2'
 	end
-
 	killvar 'i'
 end
 
@@ -330,6 +329,7 @@ if $ARGS[0] = 'printStats':
 		fightPStats['Fog'] = opp_fog[i]
 		fightPStats['Clone'] = opp_clone[i]
 		fightPStats['Stun'] = opp_stun[i]
+		fightPStats['Timer'] = opp_timer[i]
 	else
 		$fightPStats['Name'] = $pcs_name[i]
 		fightPStats['Health'] = pcs_health[i]
@@ -339,9 +339,10 @@ if $ARGS[0] = 'printStats':
 		fightPStats['Fog'] = pcs_fog[i]
 		fightPStats['Clone'] = pcs_clone[i]
 		fightPStats['Stun'] = pcs_stun[i]
+		fightPStats['Timer'] = pcs_timer[i]
 	end
 
-	'<b><<$fightPStats["Name"]>></b> life <b><font color = red><<fightPStats["Health"]>></font></b>, mana <b><font color = blue><<fightPStats["Mana"]>></font></b>, willpower <b><font color = green><<fightPStats["Willpower"]>></font></b>'
+	'<b><<$fightPStats["Name"]>></b> life <b><font color = red><<fightPStats["Health"]>></font></b>, mana <b><font color = blue><<fightPStats["Mana"]>></font></b>, willpower <b><font color = green><<fightPStats["Willpower"]>></font></b>, initiative <b><font color = orange><<fightPStats["Timer"]>></font></b>'
 	if fightPStats['Shield'] > 0:'<b><font color = purple>Protection <<fightPStats["Shield"]>> units</font></b>'
 	if fightPStats['Clone'] > 0:'<b><font color = purple>Clones active <<fightPStats["Clone"]>> </font></b>'
 	if fightPStats['Fog'] > 0:'<b><font color = purple>Obscuring Fog <<fightPStats["Fog"]>> units</font></b>'
@@ -434,6 +435,7 @@ AttackTime[2] = 15
 
 if $ARGS[0] = 'Attack':
 	$fightAtk_Type = $ARGS[1]
+	fightAtk_Type = arrpos('$AttackType',$fightAtk_Type)
 	$fightAtk_TargetType = $ARGS[2]
 	fightAtk_TargetNumber = ARGS[3]
 	fightAtk_AttackerNumber = ARGS[4]
@@ -442,6 +444,8 @@ if $ARGS[0] = 'Attack':
 		$fightAtk_AttackerType = 'pcs'
 		$fightAtk['DefenderName'] = $opp_name[fightAtk_TargetNumber]
 		$fightAtk['AttackerName'] = 'You'
+		!!Add Skill Exp
+		dynamic "<<$AttackSkill[fightAtk_Type]>>_exp += rand(1,3)"
 	elseif $fightAtk_TargetType = 'opp':
 		$fightAtk['AttackerName'] = $pcs_name[fightAtk_AttackerNumber]
 		$fightAtk['DefenderName'] = $opp_name[fightAtk_TargetNumber]
@@ -452,10 +456,10 @@ if $ARGS[0] = 'Attack':
 		$fightAtk['DefenderName'] = $pcs_name[fightAtk_TargetNumber]
 	end
 
-	fightAtk_Type = arrpos('$AttackType',$fightAtk_Type)
 	fightAtk['AttackerSkillValue'] = dyneval('result = <<$fightAtk_AttackerType>>_<<$AttackSkill[fightAtk_Type]>>[<<fightAtk_AttackerNumber>>]')
 	fightAtk['TargetReactValue'] = dyneval('result = iif(<<$fightAtk_TargetType>>_stun[<<fightAtk_TargetNumber>>]>0,0,<<$fightAtk_TargetType>>_react[<<fightAtk_TargetNumber>>])')
 	fightAtk['TargetAgilValue'] = dyneval('result = iif(<<$fightAtk_TargetType>>_stun[<<fightAtk_TargetNumber>>]>0,0,<<$fightAtk_TargetType>>_agil[<<fightAtk_TargetNumber>>])')
+	fightAtk['TargetHealthBefore'] = dyneval('result = <<$fightAtk_TargetType>>_health[<<fightAtk_TargetNumber>>]')
 	fightAtk['MinDamage'] = AttackMin[fightAtk_Type]
 	fightAtk['MaxDamage'] = AttackMax[fightAtk_Type]
 
@@ -470,15 +474,6 @@ if $ARGS[0] = 'Attack':
 		dynamic "fightAtk['Damage'] = <<$fightAtk_AttackerType>>_stren[<<fightAtk_AttackerNumber>>] * rand(<<fightAtk['MinDamage']>>,<<fightAtk['MaxDamage']>>) / 3"
 		!!Apply Damage
 		gs 'fight', 'applyDamage', $fightAtk_TargetType, fightAtk_TargetNumber, fightAtk['Damage']
-		if fightAtk['Damage'] > 25:
-			if $fightAtk_TargetType = 'opp' and fightAtk_AttackerNumber = 0:
-				'The hit is hard and <<$fightAtk["DefenderName"]>> reels in pain.'
-			else
-				'The hit is hard and you reel in pain.'
-			end
-		else
-			'Its a glancing blow, but still hurts.'
-		end
 	elseif rand(0,3) ! 0:
 		!!Always chance to hit if rand = 0
 		if $fightAtk_TargetType = 'pcs' and fightAtk_AttackerNumber = 0:
@@ -489,17 +484,33 @@ if $ARGS[0] = 'Attack':
 	else
 		!!Apply Damage
 		gs 'fight', 'applyDamage', $fightAtk_TargetType, fightAtk_TargetNumber, fightAtk['Damage']
-		if fightAtk['Damage'] > 25:
-			if $fightAtk_TargetType = 'opp' and fightAtk_AttackerNumber = 0:
-				'The hit is hard and <<$fightAtk["DefenderName"]>> reels in pain.'
-			else
-				'The hit is hard and you reel in pain.'
-			end
+	end
+	!! Flavor text for size of the hit.
+	fightAtk['TargetHealthLoss'] = fightAtk['TargetHealthBefore'] - dyneval('result = <<$fightAtk_TargetType>>_health[<<fightAtk_TargetNumber>>]')
+	!! If blow does over half health in damage, causes stun
+	if fightAtk['TargetHealthLoss']*2 > fightAtk['TargetHealthBefore']:
+		if $fightAtk_TargetType = 'pcs' and fightAtk_TargetNumber = 0:
+			'It is a devastating blow. You are stunned.'
 		else
-			'Its a glancing blow, but still hurts.'
+			'It is a devastating blow. <<$fightAtk["DefenderName"]>> is stunned.'
 		end
+		dynamic '<<$fightAtk_TargetType>>_stun[<<fightAtk_TargetNumber>>] += 1'
+	!! Very hard hit
+	elseif fightAtk['TargetHealthLoss'] > 50:
+		if $fightAtk_TargetType = 'pcs' and fightAtk_TargetNumber = 0:
+			'The hit is hard and you reel in pain.'
+		else
+			'The hit is hard and <<$fightAtk["DefenderName"]>> reels in pain.'
+		end
+	!! Does physical damage, but not a lot
+	elseif fightAtk['TargetHealthLoss'] > 0:
+		'Its a glancing blow, but still hurts.'
+	!! No physical damage was done.
+	else
+		'Defenses were not pierced.'
 	end
-	dynamic "<<$fightAtk_AttackerType>>_timer[<<fightAtk_AttackerNumber>>] += AttackTime[fightAtk_Type]"
+
+	dynamic "<<$fightAtk_AttackerType>>_timer[<<fightAtk_AttackerNumber>>] += AttackTime[<<fightAtk_Type>>]"
 	cla
 	act 'Next': gt 'fight', 'main'
 end
@@ -610,7 +621,7 @@ end
 
 if $ARGS[0] = 'opponent':
 	gs 'fight', 'statDisplay'
-	gs 'fight','fightAlgorithm','opp',ARGS[2]
+	gs 'fight','fightAlgorithm','opp',ARGS[1]
 end
 
 if $ARGS[0] = 'player':
@@ -726,7 +737,7 @@ if $ARGS[0] = 'spellcast':
 	*clr
 	cla
 	act 'Next': gt 'fight', 'main'
-	func('spellBook', 'targetable', '$combatSpells', 'pcs_timer[0] += 50 & gt ''fight'', ''main''', ' ')
+	func('spellBook', 'targetable', '$combatSpells', 'gt ''fight'', ''main''', 'pcs_timer[0] += 50')
 end
 
 

+ 79 - 54
locations/fight_npcdata.qsrc

@@ -3,6 +3,7 @@
 
 	$ARGS[0] = The NPC Name or Type (e.g: tatiana, gustav, rapist, mugger)
 	$ARGS[1] = Team to add the NPC to.  Can be 'pcs' or 'opp'.  Default is 'opp'
+	$ARGS[2] = (Optional) Name to give the NPC, Overrides built in name
 
 	Attributes that can be set:
 		name	= <<name of opponent>>
@@ -80,18 +81,18 @@ end
 if $args[0] = 'tatiana':
 	dynamic $setNPCFightStats, 'name', 'Tatiana'
 	dynamic $setNPCFightStats, 'image', 'images/characters/city/tatiana/magiclook.jpg'
-	dynamic $setNPCFightStats, 'def', 100
+	dynamic $setNPCFightStats, 'def', 30
 	dynamic $setNPCFightStats, 'run', 75
-	dynamic $setNPCFightStats, 'wrstlng', 50
-	dynamic $setNPCFightStats, 'kick', 75
-	dynamic $setNPCFightStats, 'punch', 100
-	dynamic $setNPCFightStats, 'jab', 100
-	dynamic $setNPCFightStats, 'stren', 60
-	dynamic $setNPCFightStats, 'agil', 100
+	dynamic $setNPCFightStats, 'wrstlng', 10
+	dynamic $setNPCFightStats, 'kick', 50
+	dynamic $setNPCFightStats, 'punch', 50
+	dynamic $setNPCFightStats, 'jab', 50
+	dynamic $setNPCFightStats, 'stren', 30
+	dynamic $setNPCFightStats, 'agil', 75
 	dynamic $setNPCFightStats, 'vital', 100
 	dynamic $setNPCFightStats, 'react', 60
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 1290
+	dynamic $setNPCFightStats, 'health', 1150
 	dynamic $setNPCFightStats, 'willpwr', 100
 	dynamic $setNPCFightStats, 'shoot', 100
 	dynamic $setNPCFightStats, 'magik', 1
@@ -102,19 +103,19 @@ end
 
 if $args[0] = 'prostitute':
 	dynamic $setNPCFightStats, 'name', 'Prostitute'
-	dynamic $setNPCFightStats, 'image', 'images/locations/city/shared/streetwalker/working1.jpg'
-	dynamic $setNPCFightStats, 'def', 30
-	dynamic $setNPCFightStats, 'run', 30
-	dynamic $setNPCFightStats, 'wrstlng', 20
-	dynamic $setNPCFightStats, 'kick', 0
-	dynamic $setNPCFightStats, 'punch', 10
-	dynamic $setNPCFightStats, 'jab', 10
-	dynamic $setNPCFightStats, 'stren', 20
-	dynamic $setNPCFightStats, 'agil', 30
-	dynamic $setNPCFightStats, 'vital', 50
-	dynamic $setNPCFightStats, 'react', 30
+	dynamic $setNPCFightStats, 'image', 'images/locations/city/shared/streetwalker/working<<rand(1,4)>>.jpg'
+	dynamic $setNPCFightStats, 'def', rand(25,35)
+	dynamic $setNPCFightStats, 'run', rand(25,35)
+	dynamic $setNPCFightStats, 'wrstlng', rand(5,15)
+	dynamic $setNPCFightStats, 'kick', 5
+	dynamic $setNPCFightStats, 'punch', rand(5,15)
+	dynamic $setNPCFightStats, 'jab', rand(5,15)
+	dynamic $setNPCFightStats, 'stren', rand(15,25)
+	dynamic $setNPCFightStats, 'agil', rand(25,35)
+	dynamic $setNPCFightStats, 'vital', rand(45,55)
+	dynamic $setNPCFightStats, 'react', rand(25,35)
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 600
+	dynamic $setNPCFightStats, 'health', rand(550,650)
 	dynamic $setNPCFightStats, 'willpwr', 50
 	dynamic $setNPCFightStats, 'shoot', 10
 	fightEnding = 4
@@ -123,26 +124,26 @@ end
 if $args[0] = 'bandit':
 	dynamic $setNPCFightStats, 'name', 'Bandit'
 	dynamic $setNPCFightStats, 'image', 'images/locations/shared/street/mugger.jpg'
-	dynamic $setNPCFightStats, 'def', 10
+	dynamic $setNPCFightStats, 'def', rand(5,15)
 	dynamic $setNPCFightStats, 'run', 30
-	dynamic $setNPCFightStats, 'wrstlng', 10
+	dynamic $setNPCFightStats, 'wrstlng', rand(5,15)
 	dynamic $setNPCFightStats, 'kick', 0
-	dynamic $setNPCFightStats, 'punch', 10
-	dynamic $setNPCFightStats, 'jab', 10
-	dynamic $setNPCFightStats, 'stren', 200
-	dynamic $setNPCFightStats, 'agil', 20
-	dynamic $setNPCFightStats, 'vital', 150
-	dynamic $setNPCFightStats, 'react', 20
+	dynamic $setNPCFightStats, 'punch', rand(5,15)
+	dynamic $setNPCFightStats, 'jab', rand(5,15)
+	dynamic $setNPCFightStats, 'stren', rand(95,115)
+	dynamic $setNPCFightStats, 'agil', rand(15,25)
+	dynamic $setNPCFightStats, 'vital', rand(65,75)
+	dynamic $setNPCFightStats, 'react', rand(15,25)
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 2500
-	dynamic $setNPCFightStats, 'willpwr', 100
+	dynamic $setNPCFightStats, 'health', rand(1000,1350)
+	dynamic $setNPCFightStats, 'willpwr', 50
 	dynamic $setNPCFightStats, 'shoot', 10
 	fightEnding = 5
 end
 
 if $args[0] = 'prostitute2':
 	dynamic $setNPCFightStats, 'name', 'Prostitute'
-	dynamic $setNPCFightStats, 'image', 'images/locations/city/shared/streetwalker/working1.jpg'
+	dynamic $setNPCFightStats, 'image', 'images/locations/city/shared/streetwalker/working<<rand(1,4)>>.jpg'
 	dynamic $setNPCFightStats, 'def', 10
 	dynamic $setNPCFightStats, 'run', 50
 	dynamic $setNPCFightStats, 'wrstlng', 10
@@ -169,12 +170,12 @@ if $args[0] = 'kisame':
 	dynamic $setNPCFightStats, 'kick', 0
 	dynamic $setNPCFightStats, 'punch', 100
 	dynamic $setNPCFightStats, 'jab', 100
-	dynamic $setNPCFightStats, 'stren', 200
+	dynamic $setNPCFightStats, 'stren', 150
 	dynamic $setNPCFightStats, 'agil', 100
-	dynamic $setNPCFightStats, 'vital', 200
+	dynamic $setNPCFightStats, 'vital', 150
 	dynamic $setNPCFightStats, 'react', 100
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 3000
+	dynamic $setNPCFightStats, 'health', 2250
 	dynamic $setNPCFightStats, 'willpwr', 100
 	dynamic $setNPCFightStats, 'shoot', 100
 	dynamic $setNPCFightStats, 'magik', 1
@@ -206,18 +207,18 @@ end
 if $args[0] = 'robber':
 	dynamic $setNPCFightStats, 'name', 'Robber'
 	dynamic $setNPCFightStats, 'image', 'images/locations/shared/street/mugger.jpg'
-	dynamic $setNPCFightStats, 'def', 50
-	dynamic $setNPCFightStats, 'run', 50
-	dynamic $setNPCFightStats, 'wrstlng', 10
+	dynamic $setNPCFightStats, 'def', rand(40,60)
+	dynamic $setNPCFightStats, 'run', rand(40,60)
+	dynamic $setNPCFightStats, 'wrstlng', rand(5,15)
 	dynamic $setNPCFightStats, 'kick', 0
-	dynamic $setNPCFightStats, 'punch', 50
-	dynamic $setNPCFightStats, 'jab', 50
-	dynamic $setNPCFightStats, 'stren', 70
-	dynamic $setNPCFightStats, 'agil', 40
-	dynamic $setNPCFightStats, 'vital', 50
-	dynamic $setNPCFightStats, 'react', 40
+	dynamic $setNPCFightStats, 'punch', rand(40,60)
+	dynamic $setNPCFightStats, 'jab', rand(40,60)
+	dynamic $setNPCFightStats, 'stren', rand(60,80)
+	dynamic $setNPCFightStats, 'agil', rand(30,50)
+	dynamic $setNPCFightStats, 'vital', rand(40,60)
+	dynamic $setNPCFightStats, 'react', rand(30,50)
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 840
+	dynamic $setNPCFightStats, 'health', rand(800,900)
 	dynamic $setNPCFightStats, 'willpwr', 100
 	dynamic $setNPCFightStats, 'shoot', 100
 	if rand(0,10) < 5:
@@ -230,18 +231,18 @@ end
 if $args[0] = 'snatcher':
 	dynamic $setNPCFightStats, 'name', 'Purse Snatcher'
 	dynamic $setNPCFightStats, 'image', 'images/locations/shared/street/pursesnatch.jpg'
-	dynamic $setNPCFightStats, 'def', 50
-	dynamic $setNPCFightStats, 'run', 50
-	dynamic $setNPCFightStats, 'wrstlng', 10
+	dynamic $setNPCFightStats, 'def', rand(40,60)
+	dynamic $setNPCFightStats, 'run', rand(40,60)
+	dynamic $setNPCFightStats, 'wrstlng', rand(5,15)
 	dynamic $setNPCFightStats, 'kick', 0
-	dynamic $setNPCFightStats, 'punch', 50
-	dynamic $setNPCFightStats, 'jab', 50
-	dynamic $setNPCFightStats, 'stren', 70
-	dynamic $setNPCFightStats, 'agil', 40
-	dynamic $setNPCFightStats, 'vital', 50
-	dynamic $setNPCFightStats, 'react', 40
+	dynamic $setNPCFightStats, 'punch', rand(40,60)
+	dynamic $setNPCFightStats, 'jab', rand(40,60)
+	dynamic $setNPCFightStats, 'stren', rand(60,80)
+	dynamic $setNPCFightStats, 'agil', rand(30,50)
+	dynamic $setNPCFightStats, 'vital', rand(40,60)
+	dynamic $setNPCFightStats, 'react', rand(30,50)
 	!! Health is generally :: vital * 10 + stren * 5
-	dynamic $setNPCFightStats, 'health', 840
+	dynamic $setNPCFightStats, 'health', rand(800,900)
 	dynamic $setNPCFightStats, 'willpwr', 100
 	dynamic $setNPCFightStats, 'shoot', 100
 	fightEnding = 9
@@ -329,6 +330,26 @@ if $args[0] = 'stallion':
 	fightEnding = 13
 end
 
+if $args[0] = 'ganggirl':
+	dynamic $setNPCFightStats, 'name', 'Gang Girl'
+	dynamic $setNPCFightStats, 'image', 'images/characters/shared/<<rand(31,60)>>.jpg'
+	dynamic $setNPCFightStats, 'def', rand(5,15)
+	dynamic $setNPCFightStats, 'run', rand(25,35)
+	dynamic $setNPCFightStats, 'wrstlng', rand(5,15)
+	dynamic $setNPCFightStats, 'kick', rand(5,15)
+	dynamic $setNPCFightStats, 'punch', rand(5,15)
+	dynamic $setNPCFightStats, 'jab', rand(5,15)
+	dynamic $setNPCFightStats, 'stren', rand(25,35)
+	dynamic $setNPCFightStats, 'agil', rand(25,35)
+	dynamic $setNPCFightStats, 'vital', rand(45,55)
+	dynamic $setNPCFightStats, 'react', rand(25,35)
+	!! Health is generally :: vital * 10 + stren * 5
+	dynamic $setNPCFightStats, 'health', rand(250,350)
+	dynamic $setNPCFightStats, 'willpwr', 50
+	dynamic $setNPCFightStats, 'shoot', rand(25,35)
+	fightEnding = 14
+end
+
 if $args[0] = 'girls':
 	dynamic $setNPCFightStats, 'name', 'The group of girls'
 	dynamic $setNPCFightStats, 'image', 'images/locations/shared/street/girlgang.jpg'
@@ -349,5 +370,9 @@ if $args[0] = 'girls':
 	fightEnding = 14
 end
 
+if $ARGS[2] ! '':
+	dynamic $setNPCFightStats, 'name', $ARGS[2]
+end
+
 --- fight_npcdata ---------------------------------