1
0
Преглед на файлове

Merge branch 'master' of https://git.catrenelle.com/KeyMasterOfGozer/glife

julzor преди 5 години
родител
ревизия
6140791780
променени са 7 файла, в които са добавени 220 реда и са изтрити 4 реда
  1. 2 0
      glife.qproj
  2. 21 0
      locations/spell.qsrc
  3. 75 0
      locations/spellBook.qsrc
  4. 9 2
      locations/spellList.qsrc
  5. 67 0
      locations/spellTimer.qsrc
  6. 4 0
      locations/stat.qsrc
  7. 42 2
      locations/stat_display.qsrc

+ 2 - 0
glife.qproj

@@ -1117,6 +1117,8 @@
 	<Folder name="Magic">
 		<Location name="castSpell"/>
 		<Location name="spellList"/>
+		<Location name="spellBook"/>
+		<Location name="spellTimer"/>
 		<Location name="spell"/>
 		<Location name="treeCircle"/>
 		<Location name="treeCircActs"/>

+ 21 - 0
locations/spell.qsrc

@@ -53,6 +53,27 @@ if $ARGS[0] = 'teleport':
 
 end
 
+if $ARGS[0] = 'regenerate':
+	if SuccessValue > 0:
+		! How much health is gained per minute
+		regenVal = 5 * SuccessValue
+		! Immediate health gain
+		pcs_health += regenVal
+		! Time when spell ends (totminut is right now, in minutes)
+		spellComplete = totminut + 120
+		! Code that is executed when spell completes
+		$spellCompExec = 'pcs_health += (5 * <<regenVal>>)'
+		! Code that is executed each minute the spell is running
+		$spellTickExec = 'pcs_health += <<regenVal>>'
+		! Name of spell for reportinig purposes
+		$spellTimeName = 'regenerate'
+		'<b><font color = green>Your body surges with life. You feel better already.</font></b>'
+		killvar 'regenVal'
+	else
+		'<b>The spell fizzles.  Nothing seems to happen.</b>'
+	end
+end
+
 if $ARGS[0] = 'reset':
 	cla
 	!Create mist

+ 75 - 0
locations/spellBook.qsrc

@@ -0,0 +1,75 @@
+#spellBook
+! Make a table of Spells to Cast from a given list.  the list is in the form of the lists as done in thespellList file.
+!
+! 	$ARGS[0] = the name of the array to use for the spell list.
+!	$ARGS[1] = (optional) return Action Code - a dynamic piece of code to run instead of generic return.
+!	$ARGS[2] = (optional) Additional code to put in spell link (all spells)
+!
+
+$spellBookVar['Array'] = $ARGS[0]
+$spellBookVar['ActionCode'] = $ARGS[1]
+$spellBookVar['CodeAfterSpell'] = $ARGS[2]
+
+! Make sure opptional variables have defaults
+if $spellBookVar['ActionCode'] = '':
+	$spellBookVar['ActionCode'] = "gt '<<$loc>>', '<<$metka>>'"
+end
+if $spellBookVar['CodeAfterSpell'] = '':
+	$spellBookVar['CodeAfterSpell'] = "gt '<<$loc>>', '<<$metka>>'"
+end
+
+! lets the user back out if they don''t want ot cast.
+act 'Never mind':dynamic spellBookVar['ActionCode']
+
+! This just makes sure the current spellLists are loaded
+if spellMana['fog'] = 0:
+	gs 'spellList'
+end
+
+! Build the table
+$SpellListStr = "
+<center>
+	<h1>Choose a Spell to cast.</h1>
+	<br>
+	<table CELLPADDING = '5'>
+		<tr>
+			<th align='left'>Spell</th>
+			<th align='left'>Mana</th>
+			<th align='left'>Description</th>
+		</tr>"
+i = 0
+spellBookVar['ArraySize'] = dyneval("result = arrsize('<<$spellBookVar['Array']>>')")
+numSpellsKnown = 0
+:SpellListLoop
+$ThisSpellName = dyneval("$result = <<$spellBookVar['Array']>>[<<i>>]")
+if i < spellBookVar['ArraySize']:
+	if spellKnown[$ThisSpellName] = 1:
+		$SpellListStr = $SpellListStr + " 
+		<tr>
+			<td align='left'><a href=""EXEC: gs 'castSpell', '<<$ThisSpellName>>'& <<$spellBookVar['CodeAfterSpell']>>""><<$spellName[$ThisSpellName]>></a></td>
+			<td align='right'><<spellMana[$ThisSpellName]>></td>
+			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
+		</tr>"
+		numSpellsKnown += 1
+	end
+	i += 1
+	jump 'SpellListLoop'
+end
+
+$SpellListStr = $SpellListStr + " 
+	</table>
+</center>"
+
+if numSpellsKnown = 0:
+	"You don't know any spells of this type."
+else
+	*pl func('cleanHTML',$SpellListStr)
+end
+
+killvar 'i'
+killvar 'numSpellsKnown'
+killvar '$ThisSpellName'
+killvar '$SpellListStr'
+killvar '$spellBookVar'
+killvar 'spellBookVar'
+--- spellBook ---------------------------------

+ 9 - 2
locations/spellList.qsrc

@@ -29,12 +29,18 @@ spellTime['teleport'] = 20
 spellDiff['teleport'] = 20
 $spellName['teleport'] = "Teleport"
 $spellDesc['teleport'] = "You can move from one Fairy Circle to another."
+!regenerate
+spellMana['regenerate'] = 500
+spellTime['regenerate'] = 1
+spellDiff['regenerate'] = 5
+$spellName['regenerate'] = "Regenerate"
+$spellDesc['regenerate'] = "Slowly regain health over time."
 !glamour
 spellMana['glamour'] = 500
 spellTime['glamour'] = 1
 spellDiff['glamour'] = 30
-$spellName['teleport'] = "Glamour"
-$spellDesc['teleport'] = "Change your appearance."
+$spellName['glamour'] = "Glamour"
+$spellDesc['glamour'] = "Change your appearance."
 !bodymod
 spellMana['bodymod'] = 40
 spellTime['bodymod'] = 30
@@ -293,6 +299,7 @@ $combatSpells[34] = 'greatflood'
 
 ! List of Non-Combat Spells for use in Menu
 $nonComSpells[0] = 'heal'
+$nonComSpells[1] = 'regenerate'
 
 
 ! Basic Spells

+ 67 - 0
locations/spellTimer.qsrc

@@ -0,0 +1,67 @@
+#spellTimer
+! Run the durational components of a spell.
+! Two parts:
+!	1) "Ticks" - defined things that happen every minute that passes.
+!		Examples: HoTs or DoTs type thing - Reneneration might heal some hitpoints every minute.
+!	2) "Completion" - Something that happens when a spells duration completes.
+!		Examples: A disguise spell might last for 60 minutes, and the Completion, you set back to normal.
+!
+! Arrays involved:
+!	1) spellComplete - this holds the totminut when the spell will end
+!	2) $spellCompExec - this holds some code to run once the spell ends
+!	3) $spellTickExec - this holds some code to be executed every minute the spell is in effect
+!	4) $spellTimeName - hold the name of the spell being run
+!
+! Parameters:
+!	ARGS[0] = prevtotmin = Previous Total Minutes
+!	ARGS[1] = totminut = current Total Minutes since midnight Jan 1st 2016
+if ARGS[0] = 0:
+	BeforeTime = prevtotmin
+else
+	BeforeTime = ARGS[0]
+end
+if ARGS[1] = 0:
+	AfterTime = totminut
+else
+	AfterTime = ARGS[1]
+end
+i=0
+SpellEnds = 0
+:SpellTimerLoop
+if i < arrsize('spellComplete'):
+	NumTicks = AfterTime - BeforeTime
+	if spellComplete[i] <= AfterTime:
+		NumTicks -= AfterTime - spellComplete[i]
+		SpellEnds = 1
+	else
+		SpellEnds = 0
+	end
+	if NumTicks > 0:
+		j=0
+		:SpellTickLoop
+		if j < NumTicks and $spellTickExec[i] ! '':
+			dynamic $spellTickExec[i]
+			j += 1
+			jump 'SpellTickLoop'
+		end
+	end
+	if SpellEnds = 1:
+		if $spellCompExec[i] ! '':
+			dynamic $spellCompExec[i]
+		end
+		killvar 'spellComplete', i
+		killvar '$spellTickExec', i
+		killvar '$spellCompExec', i
+		killvar '$spellTimeName', i
+	end
+	i += 1
+	jump 'SpellTimerLoop'
+end
+
+killvar 'i'
+killvar 'j'
+killvar 'NumTicks'
+killvar 'SpellEnds'
+killvar 'BeforeTime'
+Killvar 'AfterTime'
+--- spellTimer ---------------------------------

+ 4 - 0
locations/stat.qsrc

@@ -234,6 +234,8 @@ end
 if nminut ! minut or nhour ! hour:
 	! Zero totminut will be at New Years Eve of 2015
 
+	prevtotmin = totminut
+
 	! Years since 2015 in days
 	totminut = (year - 2015) * 365
 
@@ -263,6 +265,8 @@ if nminut ! minut or nhour ! hour:
 	nhour = hour
 end
 
+gs 'spellTimer', prevtotmin, totminut
+
 !!painkiller
 if pain['killer'] > 0:
 	if pain['killer'] = 1: pain_timer = totminut - 2

+ 42 - 2
locations/stat_display.qsrc

@@ -169,9 +169,49 @@ if birthday = day and birthmonth = month: $stat_msg += '<BR><b>Today is your bir
 
 !New icon based menu.
 if menu_off = 0:
-	$stat_msg += '<table><tr><td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''description''"><img src="images/system/menu icons/icon_character.png"></a></td><td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''face''"><img src="images/system/menu icons/icon_lookself.png"></a></td>'+iif(bag > 0,'<td><a href="exec:gs ''din_bad'', ''d_bag''"><img src="images/system/menu icons/icon_purse.png"></a></td>','')+'<td><a href="exec:gs ''telefon'',''Phone_menu''"><img src="images/system/menu icons/icon_phone.png"></a></td><td><a href="exec:gs ''obj_din'', ''records''"><img src="images/system/menu icons/icon_additional.png"></a></td><td><a href="exec:killvar ''menu_page'' & gs''$menu_setting''"><img src="images/system/menu icons/icon_menu.png"></a></td></tr></table>'
+	$menuBarTab += '<table>
+	<tr>
+		<td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''description''"><img src="images/system/menu icons/icon_character.png"></a></td>
+		<td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''face''"><img src="images/system/menu icons/icon_lookself.png"></a></td>'
+	if bag > 0:
+		$menuBarTab += '
+		<td><a href="exec:gs ''din_bad'', ''d_bag''"><img src="images/system/menu icons/icon_purse.png"></a></td>'
+	end
+	$menuBarTab += '
+		<td><a href="exec:gs ''telefon'',''Phone_menu''"><img src="images/system/menu icons/icon_phone.png"></a></td>'
+	if MagikDostup = 0:
+		$menuBarTab += '
+		<td><a href="exec:gs ''spellBook'',''$nonComSpells''"><img src="images/system/menu icons/icon_magic.png"></a></td>'
+	end
+	$menuBarTab += '
+		<td><a href="exec:gs ''obj_din'', ''records''"><img src="images/system/menu icons/icon_additional.png"></a></td>
+		<td><a href="exec:killvar ''menu_page'' & gs''$menu_setting''"><img src="images/system/menu icons/icon_menu.png"></a></td>
+	</tr>
+</table>'
+	$stat_msg += func('cleanHTML',$menuBarTab)
+	killvar '$menuBarTab'
 elseif menu_off = 1:
-	$stat_msg += '<table><tr><td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_character.png"></a></td><td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_lookself.png"></a></td>'+iif(bag > 0,'<td><a href="exec:gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_purse.png"></a></td>','')+'<td><a href="exec:gs ''telefon'',''Phone_menu''"><img src="images/system/menu icons/icon_phone.png"></a></td><td><a href="exec:gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_additional.png"></a></td><td><a href="exec:killvar ''menu_page'' & gs''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_menu.png"></a></td></tr></table>'
+	$menuBarTab += '<table>
+	<tr>
+		<td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_character.png"></a></td>
+		<td><a href="exec:killvar ''menu_page'' & gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_lookself.png"></a></td>'
+	if bag > 0:
+		$menuBarTab += '
+		<td><a href="exec:gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_purse.png"></a></td>'
+	end
+	$menuBarTab += '
+		<td><a href="exec:gs ''telefon'',''Phone_menu''"><img src="images/system/menu icons/icon_phone.png"></a></td>'
+	if MagikDostup = 0:
+		$menuBarTab += '
+		<td><a href="exec:gs ''spellBook'',''$nonComSpells''"><img src="images/system/menu icons/icon_magic.png"></a></td>'
+	end
+	$menuBarTab += '
+		<td><a href="exec:gs ''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_additional.png"></a></td>
+		<td><a href="exec:killvar ''menu_page'' & gs''obj_din'', ''menu_disabled''"><img src="images/system/menu icons/icon_menu.png"></a></td>
+	</tr>
+</table>'
+	$stat_msg += func('cleanHTML',$menuBarTab)
+	killvar '$menuBarTab'
 end
 
 $pockets = 'Pockets'