[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/spells.ccl doc/ChangeLog.htm...
From: |
Crestez Leonard |
Subject: |
[Stratagus-CVS] stratagus data/ccl/spells.ccl doc/ChangeLog.htm... |
Date: |
Wed, 22 Oct 2003 15:28:06 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Crestez Leonard <address@hidden> 03/10/22 15:28:06
Modified files:
data/ccl : spells.ccl
doc : ChangeLog.html
doc/ccl : magic.html
src/clone : ccl_spell.c spells.c
src/include : spells.h
Log message:
Added the spawn-missile action, removed fireball death-coil whirlwind
runes flame-shield.
Added multiple spell actions.
Patches:
Index: stratagus/data/ccl/spells.ccl
diff -u stratagus/data/ccl/spells.ccl:1.11 stratagus/data/ccl/spells.ccl:1.12
--- stratagus/data/ccl/spells.ccl:1.11 Mon Oct 20 20:18:30 2003
+++ stratagus/data/ccl/spells.ccl Wed Oct 22 15:28:04 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: spells.ccl,v 1.11 2003/10/21 00:18:30 n0body Exp $
+;; $Id: spells.ccl,v 1.12 2003/10/22 19:28:04 n0body Exp $
;; For documentation see stratagus/doc/ccl/ccl.html ;; FIXME write and move
doc.
@@ -97,7 +97,7 @@
'manacost 70
'range 'infinite
'target 'position
- 'action '(summon unit-type unit-revealer time-to-live 10)
+ 'action '( (summon unit-type unit-revealer time-to-live 10) )
'sound-when-cast "holy vision"
'missile-when-cast "missile-normal-spell"
)
@@ -107,7 +107,7 @@
'manacost 6
'range 6
'target 'unit
- 'action '(adjust-vitals hit-points 1)
+ 'action '((adjust-vitals hit-points 1))
'condition '(
organic only
building false
@@ -128,7 +128,7 @@
'manacost 4
'range 10
'target 'unit
- 'action '(adjust-vitals hit-points -1)
+ 'action '((adjust-vitals hit-points -1))
'condition '(
undead only
building false ; any undead buildings?
@@ -144,7 +144,7 @@
'manacost 70
'range 6
'target 'position
- 'action '(summon unit-type unit-eye-of-vision time-to-live 5000)
+ 'action '((summon unit-type unit-eye-of-vision time-to-live 5000))
'sound-when-cast "eye of vision"
'missile-when-cast "missile-normal-spell"
)
@@ -154,7 +154,7 @@
'manacost 50
'range 6
'target 'unit
- 'action '(adjust-buffs haste-ticks 1000 slow-ticks 0)
+ 'action '((adjust-buffs haste-ticks 1000 slow-ticks 0))
'condition '(
building false
max-haste-ticks 10 ;; FIXME: proper value?
@@ -170,7 +170,7 @@
'manacost 50
'range 10
'target 'unit
- 'action '(adjust-buffs slow-ticks 1000 haste-ticks 0)
+ 'action '((adjust-buffs slow-ticks 1000 haste-ticks 0))
'condition '(
building false
max-slow-ticks 10)
@@ -185,7 +185,7 @@
'manacost 50
'range 6
'target 'unit
- 'action '(adjust-buffs bloodlust-ticks 1000)
+ 'action '((adjust-buffs bloodlust-ticks 1000))
'condition '(
organic only
max-bloodlust-ticks 10)
@@ -200,7 +200,7 @@
'manacost 200
'range 6
'target 'unit
- 'action '(adjust-buffs invisibility-ticks 2000)
+ 'action '((adjust-buffs invisibility-ticks 2000))
'condition '(
building false
max-invisibility-ticks 10)
@@ -214,7 +214,7 @@
'manacost 100
'range 6
'target 'unit
- 'action '(adjust-buffs invincibility-ticks 500)
+ 'action '((adjust-buffs invincibility-ticks 500))
'condition '(
building false
max-invincibility-ticks 10)
@@ -228,7 +228,13 @@
'manacost 50
'range 6
'target 'unit
- 'action '(flame-shield duration 600 damage 1)
+ 'action '(
+ (spawn-missile ttl 600 damage 1)
+ (spawn-missile ttl 607 damage 1)
+ (spawn-missile ttl 614 damage 1)
+ (spawn-missile ttl 621 damage 1)
+ (spawn-missile ttl 628 damage 1)
+ )
;; I think it's better if we can cast it multiple times and the effects
stack.
;; Can be casted, and is effective on both allies and enemies
'condition '(building false)
@@ -242,7 +248,7 @@
'manacost 200
'range 10
'target 'unit
- 'action '(polymorph new-form unit-critter)
+ 'action '((polymorph new-form unit-critter))
'condition '(organic only)
'sound-when-cast "polymorph"
'missile-when-cast "missile-normal-spell"
@@ -256,13 +262,13 @@
'manacost 25
'range 12
'target 'position
- 'action '(area-bombardment
+ 'action '((area-bombardment
fields 5
shards 10
damage 10
;; 128=4*32=4 tiles
start-offset-x -128
- start-offset-y -128)
+ start-offset-y -128))
'sound-when-cast "blizzard"
'missile-when-cast "missile-blizzard"
;; 'autocast '(range 12)
@@ -273,7 +279,7 @@
'manacost 25
'range 12
'target 'position
- 'action '(area-bombardment fields 5 shards 10 damage 10)
+ 'action '((area-bombardment fields 5 shards 10 damage 10))
'sound-when-cast "death and decay"
'missile-when-cast "missile-death-and-decay"
;; 'autocast '(range 12)
@@ -284,7 +290,7 @@
'manacost 100
'range 8
'target 'position
- 'action '(fireball ttl 1000 damage 20)
+ 'action '((spawn-missile damage 20))
'sound-when-cast "fireball throw"
'missile-when-cast "missile-fireball"
;; 'autocast '(range 8)
@@ -292,10 +298,26 @@
(define-spell "spell-runes"
'showname "runes"
- 'manacost 200
+ 'manacost 10
'range 10
'target 'position
- 'action '(runes ttl 2000 damage 50)
+ 'action '(
+ (spawn-missile ttl 2000 damage 50
+ start-point (base target add-x 0 add-y 0)
+ end-point (base target add-x 0 add-y 0))
+ (spawn-missile ttl 2000 damage 50
+ start-point (base target add-x 32 add-y 0)
+ end-point (base target add-x 32 add-y 0))
+ (spawn-missile ttl 2000 damage 50
+ start-point (base target add-x 0 add-y 32)
+ end-point (base target add-x 0 add-y 32))
+ (spawn-missile ttl 2000 damage 50
+ start-point (base target add-x -32 add-y 0)
+ end-point (base target add-x -32 add-y 0))
+ (spawn-missile ttl 2000 damage 50
+ start-point (base target add-x 0 add-y -32)
+ end-point (base target add-x 0 add-y -32))
+ )
'sound-when-cast "runes"
'missile-when-cast "missile-rune"
;; 'autocast '(range 10)
@@ -306,7 +328,7 @@
'manacost 100
'range 10
'target 'position ;; FIXME position or organic target
- 'action '(fireball damage 50)
+ 'action '((spawn-missile damage 50))
; 'condition '(UnitTypeflag (true organic))
'sound-when-cast "death coil"
'missile-when-cast "missile-death-coil"
@@ -318,7 +340,7 @@
'manacost 50
'range 6
'target 'position
- 'action '(summon unit-type unit-skeleton time-to-live 100
require-corpse)
+ 'action '((summon unit-type unit-skeleton time-to-live 100
require-corpse))
'sound-when-cast "raise dead"
'missile-when-cast "missile-normal-spell"
;; 'autocast '(range 6)
@@ -329,7 +351,10 @@
'manacost 100
'range 12
'target 'position
- 'action '(whirlwind duration 801 damage 4) ; TODO damage1 4 damage2 1
+ 'action '(
+ (spawn-missile ttl 800 damage 3
+ start-point (base target add-x 0 add-y 0)
+ end-point (base target add-x 0 add-y 0)))
'sound-when-cast "whirlwind"
'missile-when-cast "missile-whirlwind"
;; 'autocast '(range 12)
@@ -340,7 +365,7 @@
'manacost 25
'range -1
'target 'position
- 'action '(spawn-portal portal-type unit-circle-of-power)
+ 'action '((spawn-portal portal-type unit-circle-of-power))
'sound-when-cast "circle of power"
'missile-when-cast "missile-normal-spell"
;; 'autocast '(range -1)
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.557 stratagus/doc/ChangeLog.html:1.558
--- stratagus/doc/ChangeLog.html:1.557 Mon Oct 20 20:18:31 2003
+++ stratagus/doc/ChangeLog.html Wed Oct 22 15:28:05 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.557 2003/10/21 00:18:31 n0body Exp $
+---- $Id: ChangeLog.html,v 1.558 2003/10/22 19:28:05 n0body Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,8 +36,9 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
- <li>Applied missile smoke patch #2133, fixed task #2786. (from Jarod
Dauphin)
- <li>Made lots of missile changes, removed Missile::Controller. (from
Crestez Leonard)
+ <li>Added the spawn-missile action, removed fireball death-coil whirlwind
runes flame-shield (from Crestez Leonard).
+ <li>Applied missile smoke patch #2133, fixed task #2786. (from Jarod
Dauphin).
+ <li>Made lots of missile changes, removed Missile::Controller. (from
Crestez Leonard).
<li>Fixed Bug #6006: Crash saving building not built yet (from Russell
Smith).
<li>Fixed Bug: Failed Building Crashes Engine (from Russell Smith).
<li>Remove old Master Server Code, began implementing a new one (from
Russell Smith).
Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.3 stratagus/doc/ccl/magic.html:1.4
--- stratagus/doc/ccl/magic.html:1.3 Mon Oct 20 20:18:31 2003
+++ stratagus/doc/ccl/magic.html Wed Oct 22 15:28:05 2003
@@ -238,8 +238,13 @@
there is no more mana left).
</dd>
<dt>action</dt>
-<dd>The effect of the spells. This comes in the form of 'action
'(operation-name parameters ... ) <br>
-Here are the supported operations , their paramenters, and what they do.<p>
+<dd>The effect of the spells. This comes in the following form:
+<pre>'action '((operation-name-1 parameters ... )
+ (operation-name-2 parameters ... )
+ ...
+ (operation-name-n parameters ... ))
+</pre>
+Here are the supported operations, their paramenters, and what they do.<p>
<dl>
<dt>area-bombardment</dt>
<dl>This will a number of missiles to be thrown in a square area. Here are
@@ -336,6 +341,43 @@
like a chicken.
</dd>
</dl>
+ <dt>spawn-missile</dt>
+ <dl>This will spawn a missile in the game. It's one of the most versatile
+ spell variants. Here are the paramenters:
+ <dt>ttl</dt>
+ <dd>Time to live for the missile. Usually means that the missile is
+ gone after this time, but for some missile classes it means something
else.
+ </dd>
+ <dt>damage</dt>
+ <dd>This is the damage for this missile, overriding the standard damage
+ defined for the missile.
+ </dd>
+ <dt>delay</dt>
+ <dd>This is the delay for the missile. it means the missile will only
+ appear after this many ticks.
+ </dd>
+ <dt>start-point/end-point</dt>
+ <dl>Point to point-ish missiles need a start and an end point for the
+ trajectory. it is defined like this:
+ <pre>start-point (base caster/target add-x add-y add-rand-x
add-rand-y)</pre>
+ The individual tags should be self-explanatory, but here goes:
+ <dt>base</dt>
+ <dd>The base for the location calculation. Can be either caster or
target.
+ </dd>
+ <dt>add-x</dt>
+ <dd>How much to add to the x coordinate, in pixels
+ </dd>
+ <dt>add-y</dt>
+ <dd>How much to add to the y coordinate, in pixels
+ </dd>
+ <dt>add-rand-x</dt>
+ <dd>Add a random from 0 to value-1 to the x coordinate, in pixels
+ </dd>
+ <dt>add-rand-y</dt>
+ <dd>Add a random from 0 to value-1 to the y coordinate, in pixels
+ </dd>
+ </dl>
+ </dl>
</dl>
</dd>
</dl>
@@ -433,7 +475,7 @@
<hr>
-Last changed: $Id: magic.html,v 1.3 2003/10/21 00:18:31 n0body Exp $<br>
+Last changed: $Id: magic.html,v 1.4 2003/10/22 19:28:05 n0body Exp $<br>
All trademarks and copyrights on this page are owned by their respective
owners.
<address>(c) 2002-2003 by <a href="http://stratagus.org">
The Stratagus Project</a></address></body></html>
Index: stratagus/src/clone/ccl_spell.c
diff -u stratagus/src/clone/ccl_spell.c:1.18
stratagus/src/clone/ccl_spell.c:1.19
--- stratagus/src/clone/ccl_spell.c:1.18 Mon Oct 20 20:18:31 2003
+++ stratagus/src/clone/ccl_spell.c Wed Oct 22 15:28:05 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_spell.c,v 1.18 2003/10/21 00:18:31 n0body Exp $
+// $Id: ccl_spell.c,v 1.19 2003/10/22 19:28:05 n0body Exp $
//@{
/*----------------------------------------------------------------------------
@@ -50,10 +50,57 @@
// Action parsers for spellAction
// **************************************************************************
-/*
+/**
+** Parse the missile location description for a spell action.
+**
+** @param list SCM list object, with the description.
+** @param location Pointer to missile location description.
+**
+** @note This is only here to avoid code duplication. You don't have
+** any reason to USE this:)
+*/
+local void CclSpellMissileLocation(SCM list, SpellActionMissileLocation*
location)
+{
+ SCM value;
+
+ DebugCheck(location == NULL);
+ memset(location, 0, sizeof(*location));
+ //list = gh_cdr(list);
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("base"))) {
+ if (gh_eq_p(gh_car(list), gh_symbol2scm("caster"))) {
+ location->Base = LocBaseCaster;
+ } else if (gh_eq_p(gh_car(list), gh_symbol2scm("target"))) {
+ location->Base = LocBaseTarget;
+ } else {
+ errl("Unsupported missile location base flag.\n",gh_car(list));
+ }
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("add-x"))) {
+ location->AddX = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("add-y"))) {
+ location->AddY = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("add-rand-x"))) {
+ location->AddRandX = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("add-rand-y"))) {
+ location->AddRandY = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else {
+ errl("Unsupported missile location description flag.\n",value);
+ }
+ }
+}
+
+/**
** Parse the action for spell.
**
-** @param list SCM list object, with somthing like
(action-type params).
+** @param list SCM list object, with something like
(action-type params).
** @param spellaction Pointer to spellactopm.
*/
local void CclSpellAction(SCM list, SpellActionType* spellaction)
@@ -66,90 +113,56 @@
value = gh_car(list);
list = gh_cdr(list);
- memset(spellaction, 0, sizeof(*spellaction));
- if (gh_eq_p(value, gh_symbol2scm("area-bombardment"))) {
- spellaction->CastFunction = CastAreaBombardment;
+ if (gh_eq_p(value, gh_symbol2scm("spawn-missile"))) {
+ spellaction->CastFunction = CastSpawnMissile;
+ spellaction->Data.SpawnMissile.StartPoint.Base=LocBaseCaster;
+ spellaction->Data.SpawnMissile.EndPoint.Base=LocBaseTarget;
+ spellaction->Data.SpawnMissile.TTL=-1;
while (!gh_null_p(list)) {
value = gh_car(list);
list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("fields"))) {
- spellaction->Data.AreaBombardment.Fields =
gh_scm2int(gh_car(list));
+ if (gh_eq_p(value, gh_symbol2scm("damage"))) {
+ spellaction->Data.SpawnMissile.Damage =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("shards"))) {
- spellaction->Data.AreaBombardment.Shards =
gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("delay"))) {
+ spellaction->Data.SpawnMissile.Delay = gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.AreaBombardment.Damage =
gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
+ spellaction->Data.SpawnMissile.TTL = gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("start-offset-x"))) {
- spellaction->Data.AreaBombardment.StartOffsetX =
gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("start-point"))) {
+
CclSpellMissileLocation(gh_car(list),&spellaction->Data.SpawnMissile.StartPoint);
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("start-offset-y"))) {
- spellaction->Data.AreaBombardment.StartOffsetY =
gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("end-point"))) {
+
CclSpellMissileLocation(gh_car(list),&spellaction->Data.SpawnMissile.EndPoint);
list = gh_cdr(list);
} else {
errl("Unsupported area-bombardment tag", value);
}
}
- } else if (gh_eq_p(value, gh_symbol2scm("flame-shield"))) {
- spellaction->CastFunction = CastFlameShield;
- while (!gh_null_p(list)) {
- value = gh_car(list);
- list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("duration"))) {
- spellaction->Data.FlameShield.TTL = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- /// FIXME:damage, missiles, rotation speed?
- } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.FlameShield.Damage = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- }else {
- errl("Unsupported flame-shield tag", value);
- }
- }
- } else if (gh_eq_p(value, gh_symbol2scm("fireball"))) {
- spellaction->CastFunction = CastFireball;
+
+ } else if (gh_eq_p(value, gh_symbol2scm("area-bombardment"))) {
+ spellaction->CastFunction = CastAreaBombardment;
while (!gh_null_p(list)) {
value = gh_car(list);
list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.Fireball.Damage = gh_scm2int(gh_car(list));
- list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
- spellaction->Data.Fireball.TTL = gh_scm2int(gh_car(list));
+ if (gh_eq_p(value, gh_symbol2scm("fields"))) {
+ spellaction->Data.AreaBombardment.Fields =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else {
- errl("Unsupported fireball tag", value);
- }
- }
- } else if (gh_eq_p(value, gh_symbol2scm("runes"))) {
- spellaction->CastFunction = CastRunes;
- while (!gh_null_p(list)) {
- value = gh_car(list);
- list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.Runes.Damage = gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("shards"))) {
+ spellaction->Data.AreaBombardment.Shards =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("ttl"))) {
- spellaction->Data.Runes.TTL = gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
+ spellaction->Data.AreaBombardment.Damage =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else {
- errl("Unsupported runes tag", value);
- }
- }
- } else if (gh_eq_p(value, gh_symbol2scm("whirlwind"))) {
- spellaction->CastFunction = CastWhirlwind;
- while (!gh_null_p(list)) {
- value = gh_car(list);
- list = gh_cdr(list);
- if (gh_eq_p(value, gh_symbol2scm("duration"))) {
- spellaction->Data.Whirlwind.TTL = gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("start-offset-x"))) {
+ spellaction->Data.AreaBombardment.StartOffsetX =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
- } else if (gh_eq_p(value, gh_symbol2scm("damage"))) {
- spellaction->Data.Whirlwind.Damage = gh_scm2int(gh_car(list));
+ } else if (gh_eq_p(value, gh_symbol2scm("start-offset-y"))) {
+ spellaction->Data.AreaBombardment.StartOffsetY =
gh_scm2int(gh_car(list));
list = gh_cdr(list);
} else {
- errl("Unsupported runes tag", value);
+ errl("Unsupported area-bombardment tag", value);
}
}
} else if (gh_eq_p(value, gh_symbol2scm("adjust-buffs"))) {
@@ -426,6 +439,8 @@
char* str;
SpellType* spell;
SCM value;
+ SCM sublist;
+ SpellActionType* act;
identname = gh_scm2newstr(gh_car(list), NULL);
list = gh_cdr(list);
@@ -473,10 +488,19 @@
}
list = gh_cdr(list);
} else if (gh_eq_p(value, gh_symbol2scm("action"))) {
- if (!spell->Action) {
- spell->Action =
(SpellActionType*)malloc(sizeof(SpellActionType));
+ spell->Action = (SpellActionType*)malloc(sizeof(SpellActionType));
+ act=spell->Action;
+ memset(act, 0, sizeof(SpellActionType));
+ sublist=gh_car(list);
+ CclSpellAction(gh_car(sublist), act);
+ sublist=gh_cdr(sublist);
+ while (!gh_null_p(gh_car(sublist))) {
+ act->Next = (SpellActionType*)malloc(sizeof(SpellActionType));
+ act=act->Next;
+ memset(act, 0, sizeof(SpellActionType));
+ CclSpellAction(gh_car(sublist), act);
+ sublist=gh_cdr(sublist);
}
- CclSpellAction(gh_car(list), spell->Action);
list = gh_cdr(list);
} else if (gh_eq_p(value, gh_symbol2scm("condition"))) {
if (!spell->Condition) {
@@ -549,17 +573,44 @@
*/
local void SaveSpellAction(CLFile *file,SpellActionType* action)
{
+ SpellActionMissileLocation * loc;
if (action->CastFunction == CastAreaBombardment) {
CLprintf(file, "(area-bombardment fields %d shards %d damage %d
start-offset-x %d start-offset-y %d)",
- action->Data.AreaBombardment.Fields,
- action->Data.AreaBombardment.Shards,
- action->Data.AreaBombardment.Damage,
- action->Data.AreaBombardment.StartOffsetX,
- action->Data.AreaBombardment.StartOffsetY);
- } else if (action->CastFunction == CastFireball) {
- CLprintf(file, "(fireball ttl %d damage %d)",
- action->Data.Fireball.TTL,
- action->Data.Fireball.Damage);
+ action->Data.AreaBombardment.Fields,
+ action->Data.AreaBombardment.Shards,
+ action->Data.AreaBombardment.Damage,
+ action->Data.AreaBombardment.StartOffsetX,
+ action->Data.AreaBombardment.StartOffsetY);
+ } else if (action->CastFunction == CastSpawnMissile) {
+ CLprintf(file, "(spawn-missile delay %d ttl %d damage %d ",
+ action->Data.SpawnMissile.Delay,
+ action->Data.SpawnMissile.TTL,
+ action->Data.SpawnMissile.Damage);
+ //
+ // Save start-point
+ //
+ loc=&action->Data.SpawnMissile.StartPoint;
+ CLprintf(file, "start-point (base ");
+ if (loc->Base==LocBaseCaster) {
+ CLprintf(file, "caster");
+ } else {
+ CLprintf(file, "target");
+ }
+ CLprintf(file, " add-x %d add-y %d add-rand-x %d add-rand-y %d) ",
+ loc->AddX,loc->AddY,loc->AddRandX,loc->AddRandY);
+ //
+ // Save end-point
+ //
+ loc=&action->Data.SpawnMissile.EndPoint;
+ CLprintf(file, "end-point (base ");
+ if (loc->Base==LocBaseCaster) {
+ CLprintf(file, "caster");
+ } else {
+ CLprintf(file, "target");
+ }
+ CLprintf(file, " add-x %d add-y %d add-rand-x %d add-rand-y %d)",
+ loc->AddX,loc->AddY,loc->AddRandX,loc->AddRandY);
+ CLprintf(file, ")");
} else if (action->CastFunction == CastAdjustVitals) {
CLprintf(file, "(adjust-vitals");
if (action->Data.AdjustVitals.HP) {
@@ -574,8 +625,8 @@
CLprintf(file, ")\n");
} else if (action->CastFunction == CastSummon) {
CLprintf(file, "(summon unit-type %s time-to-live %d",
- action->Data.Summon.UnitType->Ident,
- action->Data.Summon.TTL);
+ action->Data.Summon.UnitType->Ident,
+ action->Data.Summon.TTL);
if (action->Data.Summon.RequireCorpse) {
CLprintf(file, " require-corpse ");
}
@@ -600,20 +651,10 @@
CLprintf(file, ")");
} else if (action->CastFunction == CastPolymorph) {
CLprintf(file, "(polymorph new-form %s)",
- action->Data.Polymorph.NewForm->Ident);
- } else if (action->CastFunction == CastFlameShield) {
- CLprintf(file, "(flame-shield duration %d)",
- action->Data.FlameShield.TTL);
- } else if (action->CastFunction == CastRunes) {
- CLprintf(file, "(runes ttl %d damage %d)",
- action->Data.Runes.TTL,
- action->Data.Runes.Damage);
+ action->Data.Polymorph.NewForm->Ident);
} else if (action->CastFunction == CastSpawnPortal) {
CLprintf(file, "(spawn-portal portal-type %s)",
- action->Data.SpawnPortal.PortalType->Ident);
- } else if (action->CastFunction == CastWhirlwind) {
- CLprintf(file, "(whirlwind duration %d damage %d)",
- action->Data.Whirlwind.TTL, action->Data.Whirlwind.Damage);
+ action->Data.SpawnPortal.PortalType->Ident);
}
}
@@ -717,6 +758,7 @@
global void SaveSpells(CLFile* file)
{
SpellType* spell;
+ SpellActionType* act;
DebugCheck(!file);
@@ -756,9 +798,15 @@
//
// Save the action(effect of the spell)
//
- CLprintf(file, " 'action '");
- SaveSpellAction(file, spell->Action);
- CLprintf(file, "\n");
+ CLprintf(file, " 'action '(\n");
+ act=spell->Action;
+ while (act) {
+ CLprintf(file," ");
+ SaveSpellAction(file, act);
+ CLprintf(file,"\n");
+ act=act->Next;
+ }
+ CLprintf(file, ")\n");
//
// Save conditions
//
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.111 stratagus/src/clone/spells.c:1.112
--- stratagus/src/clone/spells.c:1.111 Mon Oct 20 20:18:31 2003
+++ stratagus/src/clone/spells.c Wed Oct 22 15:28:05 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.c,v 1.111 2003/10/21 00:18:31 n0body Exp $
+// $Id: spells.c,v 1.112 2003/10/22 19:28:05 n0body Exp $
/*
** And when we cast our final spell
@@ -98,7 +98,7 @@
** @return =!0 if spell should be repeated, 0 if not
*/
global int CastSpawnPortal(Unit* caster, const SpellType* spell
__attribute__((unused)),
- Unit* target __attribute__((unused)), int x, int y)
+ const SpellActionType* action,Unit* target __attribute__((unused)), int
x, int y)
{
// FIXME: vladi: cop should be placed only on explored land
Unit* portal;
@@ -146,7 +146,7 @@
** @return =!0 if spell should be repeated, 0 if not
*/
global int CastAreaBombardment(Unit* caster, const SpellType* spell,
- Unit* target __attribute__((unused)), int x, int y)
+ const SpellActionType* action,Unit* target __attribute__((unused)), int
x, int y)
{
int fields;
int shards;
@@ -198,54 +198,47 @@
caster->Refs++;
}
}
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
- caster->Mana -= spell->ManaCost;
return caster->Mana > spell->ManaCost;
}
/**
-** Cast fireball.
+** Evaluate missile location description.
**
** @param caster Unit that casts the spell
-** @param spell Spell-type pointer
** @param target Target unit that spell is addressed to
** @param x X coord of target spot when/if target does not exist
** @param y Y coord of target spot when/if target does not exist
**
-** @return =!0 if spell should be repeated, 0 if not
+** @param resx pointer to X coord of the result
+** @param resy pointer to Y coord of the result
*/
-global int CastFireball(Unit* caster, const SpellType* spell,
- Unit* target __attribute__((unused)), int x, int y)
+local void EvaluateMissileLocation(const SpellActionMissileLocation* location,
+ Unit* caster,Unit* target, int x, int y,int* resx, int* resy)
{
- Missile* missile;
- int sx;
- int sy;
-
- DebugCheck(!caster);
- DebugCheck(!spell);
- DebugCheck(!spell->Action);
- DebugCheck(!spell->Missile);
-
- missile = NULL;
-
- // NOTE: fireball can be casted on spot
- sx = caster->X * TileSizeX + TileSizeX / 2;
- sy = caster->Y * TileSizeY + TileSizeY / 2;
- x = x * TileSizeX + TileSizeX / 2;
- y = y * TileSizeY + TileSizeY / 2;
- caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
- missile = MakeMissile(spell->Missile, sx, sy, x, y);
-// missile->TTL = spell->Action->Data.Fireball.TTL;
- missile->Damage = spell->Action->Data.Fireball.Damage;
- missile->SourceUnit = caster;
- RefsDebugCheck(!caster->Refs || caster->Destroyed);
- caster->Refs++;
- return 0;
+ if (location->Base==LocBaseCaster) {
+ *resx = caster->X * TileSizeX + TileSizeX / 2;
+ *resy = caster->Y * TileSizeY + TileSizeY / 2;
+ } else {
+ if (target) {
+ *resx = target->X * TileSizeX + TileSizeX / 2;
+ *resy = target->Y * TileSizeY + TileSizeY / 2;
+ } else {
+ *resx = x * TileSizeX + TileSizeX / 2;
+ *resy = y * TileSizeY + TileSizeY / 2;
+ }
+ }
+ *resx += location->AddX;
+ if (location->AddRandX) {
+ *resx += rand()%location->AddRandX;
+ }
+ *resy += location->AddY;
+ if (location->AddRandY) {
+ *resy += rand()%location->AddRandY;
+ }
}
/**
-** Cast flame shield.
+** Cast spawn missile.
**
** @param caster Unit that casts the spell
** @param spell Spell-type pointer
@@ -255,33 +248,35 @@
**
** @return =!0 if spell should be repeated, 0 if not
*/
-global int CastFlameShield(Unit* caster, const SpellType* spell, Unit* target,
- int x __attribute__((unused)), int y __attribute__((unused)))
+global int CastSpawnMissile(Unit* caster, const SpellType* spell,
+ const SpellActionType* action, Unit* target, int x, int y)
{
- Missile* mis;
- int i;
+ Missile* missile;
+ int sx;
+ int sy;
+ int dx;
+ int dy;
DebugCheck(!caster);
DebugCheck(!spell);
DebugCheck(!spell->Action);
- DebugCheck(!target);
-// DebugCheck(x in range, y in range);
DebugCheck(!spell->Missile);
- mis = NULL;
+ missile = NULL;
- // get mana cost
- caster->Mana -= spell->ManaCost;
- target->FlameShield = spell->Action->Data.FlameShield.TTL;
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
- for (i = 0; i < 5; ++i) {
- mis = MakeMissile(spell->Missile, 0, 0, 0, 0);
- mis->TTL = spell->Action->Data.FlameShield.TTL + i * 7;
- mis->TargetUnit = target;
- mis->Damage = spell->Action->Data.FlameShield.Damage;
- RefsDebugCheck(!target->Refs || target->Destroyed);
- target->Refs++;
- }
+ EvaluateMissileLocation(&action->Data.SpawnMissile.StartPoint,
+ caster,target,x,y,&sx,&sy);
+ EvaluateMissileLocation(&action->Data.SpawnMissile.EndPoint,
+ caster,target,x,y,&dx,&dy);
+
+ missile = MakeMissile(spell->Missile, sx, sy, dx, dy);
+ missile->TTL = action->Data.SpawnMissile.TTL;
+ missile->Delay = action->Data.SpawnMissile.Delay;
+ missile->Damage = action->Data.SpawnMissile.Damage;
+ missile->SourceUnit = caster;
+ missile->TargetUnit = target;
+ RefsDebugCheck(!caster->Refs || caster->Destroyed);
+ caster->Refs++;
return 0;
}
@@ -296,17 +291,14 @@
**
** @return =!0 if spell should be repeated, 0 if not
*/
-global int CastAdjustBuffs(Unit* caster, const SpellType* spell, Unit* target,
- int x, int y)
+global int CastAdjustBuffs(Unit* caster, const SpellType* spell,
+ const SpellActionType* action, Unit* target, int x, int y)
{
DebugCheck(!caster);
DebugCheck(!spell);
DebugCheck(!spell->Action);
DebugCheck(!target);
- // get mana cost
- caster->Mana -= spell->ManaCost;
-
if (spell->Action->Data.AdjustBuffs.HasteTicks!=BUFF_NOT_AFFECTED) {
target->Haste = spell->Action->Data.AdjustBuffs.HasteTicks;
}
@@ -323,7 +315,6 @@
target->UnholyArmor =
spell->Action->Data.AdjustBuffs.InvincibilityTicks;
}
CheckUnitToBeDrawn(target);
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX+TileSizeX / 2, y * TileSizeY+TileSizeY / 2,
x * TileSizeX+TileSizeX / 2, y * TileSizeY+TileSizeY / 2);
@@ -341,8 +332,8 @@
**
** @return =!0 if spell should be repeated, 0 if not
*/
-global int CastAdjustVitals(Unit* caster, const SpellType* spell, Unit* target,
- int x, int y)
+global int CastAdjustVitals(Unit* caster, const SpellType* spell,
+ const SpellActionType* action,Unit* target,int x, int y)
{
int castcount;
int diffHP;
@@ -415,7 +406,6 @@
DebugLevel3Fn("Unit now has %d hp and %d mana.\n" _C_
target->HP _C_ target->Mana);
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
@@ -433,8 +423,8 @@
**
** @return =!0 if spell should be repeated, 0 if not
*/
-global int CastPolymorph(Unit* caster, const SpellType* spell, Unit* target,
- int x, int y)
+global int CastPolymorph(Unit* caster, const SpellType* spell,
+ const SpellActionType* action, Unit* target,int x, int y)
{
UnitType* type;
@@ -466,8 +456,6 @@
if (UnitTypeCanMoveTo(x, y, type)) {
MakeUnitAndPlace(x, y, type, Players + PlayerNumNeutral);
}
- caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
@@ -475,56 +463,6 @@
}
/**
-** Cast runes.
-**
-** @param caster Unit that casts the spell
-** @param spell Spell-type pointer
-** @param target Target unit that spell is addressed to
-** @param x X coord of target spot when/if target does not exist
-** @param y Y coord of target spot when/if target does not exist
-**
-** @return =!0 if spell should be repeated, 0 if not
-*/
-global int CastRunes(Unit* caster, const SpellType* spell,
- Unit* target __attribute__((unused)), int x, int y)
-{
- Missile* mis;
- const int xx[] = {-1,+1, 0, 0, 0};
- const int yy[] = { 0, 0, 0,-1,+1};
- int oldx;
- int oldy;
- int i;
-
- DebugCheck(!caster);
- DebugCheck(!spell);
- DebugCheck(!spell->Action);
-// DebugCheck(x in range, y in range);
-
- mis = NULL;
- oldx = x;
- oldy = y;
-
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
- for (i = 0; i < 5; ++i) {
- x = oldx + xx[i];
- y = oldy + yy[i];
-
- if (IsMapFieldEmpty(x, y)) {
- mis = MakeMissile(spell->Missile,
- x * TileSizeX + TileSizeX / 2,
- y * TileSizeY + TileSizeY / 2,
- x * TileSizeX + TileSizeX / 2,
- y * TileSizeY + TileSizeY / 2);
- mis->TTL = spell->Action->Data.Runes.TTL;
- mis->Damage = spell->Action->Data.Runes.Damage;
- mis->SourceUnit = caster;
- caster->Mana -= spell->ManaCost / 5;
- }
- }
- return 0;
-}
-
-/**
** Cast summon spell.
**
** @param caster Unit that casts the spell
@@ -535,8 +473,8 @@
**
** @return =!0 if spell should be repeated, 0 if not
*/
-global int CastSummon(Unit* caster, const SpellType* spell, Unit* target,
- int x, int y)
+global int CastSummon(Unit* caster, const SpellType* spell,
+ const SpellActionType* action,Unit* target,int x, int y)
{
int ttl;
int cansummon;
@@ -611,47 +549,12 @@
caster->Mana -= spell->ManaCost;
}
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
MakeMissile(spell->Missile,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
return 0;
}
-/**
-** Cast whirlwind.
-**
-** @param caster Unit that casts the spell
-** @param spell Spell-type pointer
-** @param target Target unit that spell is addressed to
-** @param x X coord of target spot when/if target does not exist
-** @param y Y coord of target spot when/if target does not exist
-**
-** @return =!0 if spell should be repeated, 0 if not
-*/
-global int CastWhirlwind(Unit* caster, const SpellType* spell,
- Unit* target __attribute__((unused)), int x, int y)
-{
- Missile* mis;
-
- DebugCheck(!caster);
- DebugCheck(!spell);
- DebugCheck(!spell->Action);
-// DebugCheck(x in range, y in range);
-
- mis = NULL;
-
- caster->Mana -= spell->ManaCost;
- PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
- mis = MakeMissile(spell->Missile,
- x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
- x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
- mis->TTL = spell->Action->Data.Whirlwind.TTL;
- mis->Damage = spell->Action->Data.Whirlwind.Damage;
- mis->SourceUnit = caster;
- return 0;
-}
-
// ****************************************************************************
// Target constructor
// ****************************************************************************
@@ -1144,6 +1047,7 @@
global int SpellCast(Unit* caster, const SpellType* spell, Unit* target,
int x, int y)
{
+ SpellActionType* act;
DebugCheck(!spell);
DebugCheck(!spell->Action->CastFunction);
DebugCheck(!caster);
@@ -1159,8 +1063,21 @@
}
DebugLevel3Fn("Spell cast: (%s), %s -> %s (%d,%d)\n" _C_ spell->IdentName
_C_
unit->Type->Name _C_ target ? target->Type->Name : "none" _C_ x _C_ y);
- return CanCastSpell(caster, spell, target, x, y) &&
- spell->Action->CastFunction(caster, spell, target, x, y);
+ if (CanCastSpell(caster, spell, target, x, y)) {
+ act=spell->Action;
+ //
+ // Ugly hack, CastAdjustVitals makes it's own mana calculation.
+ //
+ if (act->CastFunction!=CastAdjustVitals) {
+ caster->Mana -= spell->ManaCost;
+ }
+ PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
+ while (act) {
+ act->CastFunction(caster, spell, act, target, x, y);
+ act=act->Next;
+ }
+ }
+ return 0;
}
/*
Index: stratagus/src/include/spells.h
diff -u stratagus/src/include/spells.h:1.32 stratagus/src/include/spells.h:1.33
--- stratagus/src/include/spells.h:1.32 Mon Oct 20 20:18:31 2003
+++ stratagus/src/include/spells.h Wed Oct 22 15:28:05 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: spells.h,v 1.32 2003/10/21 00:18:31 n0body Exp $
+// $Id: spells.h,v 1.33 2003/10/22 19:28:05 n0body Exp $
#ifndef __SPELLS_H__
#define __SPELLS_H__
@@ -51,47 +51,58 @@
-- Definitons
----------------------------------------------------------------------------*/
-enum {
- flag_slow,
- flag_haste,
- flag_bloodlust,
- flag_invisibility,
- flag_unholyarmor,
- flag_flameshield,
- flag_HP,
- flag_Mana,
- flag_HP_percent,
- flag_Mana_percent,
- flag_coward,
- flag_organic,
- flag_isundead,
- flag_canattack,
- flag_building
-};
-
/**
** Different targets.
*/
typedef enum {
- TargetSelf,
- TargetPosition,
- TargetUnit
-#if 0
- ,
- TargetUnits
-#endif
-} TargetType;
+ TargetSelf,
+ TargetPosition,
+ TargetUnit
+} TargetType;
+typedef struct _spell_action_type_ SpellActionType;
/*
** Pointer on function that cast the spell.
*/
-typedef int SpellFunc(Unit* caster, const struct _spell_type_* spell, Unit*
target,int x, int y);
+typedef int SpellFunc(Unit* caster, const struct _spell_type_* spell,
+ const struct _spell_action_type_* action, Unit* target, int x, int y);
+
+/**
+** Different targets.
+*/
+typedef enum {
+ LocBaseCaster,
+ LocBaseTarget
+} LocBaseType;
+
+/*
+** This struct is used for defining a missile start/stop location.
+**
+** It's evaluated like this, and should be more or less flexible.:
+** base coordinates(caster or target) + (AddX,AddY) +
(rand()%AddRandX,rand()%AddRandY)
+**
+**/
+typedef struct {
+ LocBaseType Base; /// The base for the location (caster/target)
+ int AddX; /// Add to the X coordinate
+ int AddY; /// Add to the X coordinate
+ int AddRandX; /// Random add to the X coordinate
+ int AddRandY; /// Random add to the X coordinate
+} SpellActionMissileLocation;
-typedef struct
-{
+struct _spell_action_type_ {
SpellFunc* CastFunction;
+
+ // FIXME" some time information doesn't work as it should.
union {
-// FIXME time information doesn't work as it should.
+ struct {
+ int Damage; /// Missile damage
+ int TTL; /// Missile TTL
+ int Delay; /// Missile original
delay
+ SpellActionMissileLocation StartPoint; /// Start point
description
+ SpellActionMissileLocation EndPoint; /// Start point
description
+ } SpawnMissile;
+
struct {
int Fields; /// The size of the affected square
int Shards; /// Number of shards thrown.
@@ -106,16 +117,6 @@
} SpawnPortal;
struct {
- int TTL; /// time to live (ticks)
- int Damage; /// Damage.
- } Fireball;
-
- struct {
- int TTL; /// time to live (ticks)
- int Damage; /// Damage.
- } FlameShield;
-
- struct {
int HasteTicks; /// Number of ticks to set Haste to.
int SlowTicks; /// Number of ticks to set Slow to.
int BloodlustTicks; /// Number of ticks to set Bloodlust to.
@@ -143,18 +144,9 @@
int RequireCorpse; /// Corpse consumed while summoning.
} Summon;
// What about a resurection spell?
-
- struct {
- int TTL; /// time to live (ticks)
- int Damage; /// Damage.
- } Runes;
-
- struct {
- int TTL; /// time to live (ticks)
- int Damage; /// Damage.
- } Whirlwind;
} Data;
-} SpellActionType;
+ SpellActionType* Next; /// Next action.
+};
/*
** *******************
@@ -331,15 +323,12 @@
SpellFunc CastAdjustVitals;
SpellFunc CastAdjustBuffs;
-SpellFunc CastFireball;
-SpellFunc CastFlameShield;
SpellFunc CastPolymorph;
SpellFunc CastAreaBombardment;
SpellFunc CastSummon;
-SpellFunc CastRunes;
SpellFunc CastDeathCoil;
-SpellFunc CastWhirlwind;
SpellFunc CastSpawnPortal;
+SpellFunc CastSpawnMissile;
//@}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/spells.ccl doc/ChangeLog.htm...,
Crestez Leonard <=