stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus data/ccl/spells.ccl doc/ccl/magic.htm...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus data/ccl/spells.ccl doc/ccl/magic.htm...
Date: Tue, 28 Oct 2003 20:55:33 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/10/28 20:55:32

Modified files:
        data/ccl       : spells.ccl 
        doc/ccl        : magic.html 
        src/clone      : ccl_spell.c spells.c 
        src/include    : spells.h 

Log message:
        Tweaked some spells for repeat-cast (blizzard and raise-dead.)

Patches:
Index: stratagus/data/ccl/spells.ccl
diff -u stratagus/data/ccl/spells.ccl:1.18 stratagus/data/ccl/spells.ccl:1.19
--- stratagus/data/ccl/spells.ccl:1.18  Tue Oct 28 07:08:27 2003
+++ stratagus/data/ccl/spells.ccl       Tue Oct 28 20:55:31 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.18 2003/10/28 12:08:27 n0body Exp $

+;;     $Id: spells.ccl,v 1.19 2003/10/29 01:55:31 n0body Exp $

 

 ;; For documentation see stratagus/doc/ccl/ccl.html ;; FIXME write and move 
doc.

 

@@ -213,6 +213,7 @@
        'showname "blizzard"

        'manacost 25

        'range  12

+       'repeat-cast

        'target 'position

        'action '((area-bombardment

             fields 5

@@ -291,6 +292,7 @@
        'showname "raise dead"

        'manacost 50

        'range  6

+       'repeat-cast

        'target 'position

        'action '((summon unit-type unit-skeleton time-to-live 3600 
require-corpse))

        'sound-when-cast "raise dead"

Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.6 stratagus/doc/ccl/magic.html:1.7
--- stratagus/doc/ccl/magic.html:1.6    Sat Oct 25 19:10:43 2003
+++ stratagus/doc/ccl/magic.html        Tue Oct 28 20:55:31 2003
@@ -212,7 +212,7 @@
 <a name="define-spell"></a>
 <h3>(define-spell spell-ident tag value ... )</h3>
 This is the function to define a spell, icluding it's effects and targetting
-conditions.
+conditions. Be very carefull, defining random flags will probably make the 
game crash.
 
 <dl>
 <dt>showname</dt>
@@ -221,6 +221,10 @@
 <dt>manacost</dt>
 <dd>The mana cost of the spell. Maybe this should be set on a per-caster basis?
 </dd>
+<dt>repeat-cast</dt>
+<dd>If specified, the caster will cast it again. To be used with spells like
+area-bombardment to cast it again (area-bombardment is stackable)
+</dd>
 <dt>range</dt>
 <dd>The casting range of the spell, do not confuse this with area effect range.
 It's normally an integer value, but you can specify a special value 'infinite 
to
@@ -490,7 +494,7 @@
 
 
 <hr>
-Last changed: $Id: magic.html,v 1.6 2003/10/25 23:10:43 n0body Exp $<br>
+Last changed: $Id: magic.html,v 1.7 2003/10/29 01:55:31 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.23 
stratagus/src/clone/ccl_spell.c:1.24
--- stratagus/src/clone/ccl_spell.c:1.23        Tue Oct 28 07:08:29 2003
+++ stratagus/src/clone/ccl_spell.c     Tue Oct 28 20:55:32 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_spell.c,v 1.23 2003/10/28 12:08:29 n0body Exp $
+//     $Id: ccl_spell.c,v 1.24 2003/10/29 01:55:32 n0body Exp $
 //@{
 
 /*----------------------------------------------------------------------------
@@ -504,6 +504,8 @@
                spell->Range = gh_scm2int(gh_car(list));
            }
            list = gh_cdr(list);
+       } else if (gh_eq_p(value, gh_symbol2scm("repeat-cast"))) {
+           spell->RepeatCast=1;
        } else if (gh_eq_p(value, gh_symbol2scm("target"))) {
            value = gh_car(list);
            if (gh_eq_p(value, gh_symbol2scm("self"))) {
@@ -805,6 +807,10 @@
        //
        CLprintf(file, "    \"%s\"\n", spell->IdentName);
        CLprintf(file, "    'showname \"%s\"\n", spell->Name);
+       CLprintf(file, "    'manacost %d\n", spell->ManaCost);
+       if (spell->RepeatCast) {
+           CLprintf(file, "    'repeat-cast\n");
+       }
        CLprintf(file, "    'manacost %d\n", spell->ManaCost);
        CLprintf(file, "    'range %d\n", spell->Range);
        if (spell->SoundWhenCast.Name) { 
Index: stratagus/src/clone/spells.c
diff -u stratagus/src/clone/spells.c:1.118 stratagus/src/clone/spells.c:1.119
--- stratagus/src/clone/spells.c:1.118  Tue Oct 28 07:08:29 2003
+++ stratagus/src/clone/spells.c        Tue Oct 28 20:55:32 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: spells.c,v 1.118 2003/10/28 12:08:29 n0body Exp $
+//     $Id: spells.c,v 1.119 2003/10/29 01:55:32 n0body Exp $
 
 /*
 **     And when we cast our final spell
@@ -162,7 +162,7 @@
            }
        }
     }
-    return 0;
+    return 1;
 }
 
 /**
@@ -335,7 +335,7 @@
            caster->Refs++;
        }
     }
-    return caster->Mana > spell->ManaCost;
+    return 1;
 }
 
 /**
@@ -414,7 +414,7 @@
     missile->TargetUnit = target;
     RefsDebugCheck(!caster->Refs || caster->Destroyed);
     caster->Refs++;
-    return 0;
+    return 1;
 }
 
 /**
@@ -679,16 +679,20 @@
            target->CurrentSightRange = target->Stats->SightRange;
            MapMarkUnitSight(target);
        } else {
+           //  This is a hack to walk around behaviour of DropOutOnSide
+           target->X++;
            DropOutOnSide(target, LookingW, 0, 0);
            CheckUnitToBeDrawn(target);
        }
        
        caster->Mana -= spell->ManaCost;
+
+       MakeMissile(spell->Missile,
+           x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
+           x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
+       return 1;
     }
 
-    MakeMissile(spell->Missile,
-       x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2,
-       x * TileSizeX + TileSizeX / 2, y * TileSizeY + TileSizeY / 2);
     return 0;
 }
 
@@ -1172,6 +1176,8 @@
 global int SpellCast(Unit* caster, const SpellType* spell, Unit* target,
     int x, int y)
 {
+    int cont;
+
     SpellActionType* act;
     DebugCheck(!spell);
     DebugCheck(!spell->Action->CastFunction);
@@ -1198,6 +1204,7 @@
        unit->Type->Name _C_ target ? target->Type->Name : "none" _C_ x _C_ y);
     if (CanCastSpell(caster, spell, target, x, y)) {
        act=spell->Action;
+       cont=1;
        //
        //  Ugly hack, CastAdjustVitals makes it's own mana calculation.
        //
@@ -1208,11 +1215,24 @@
        PlayGameSound(spell->SoundWhenCast.Sound, MaxSampleVolume);
        while (act) {
            DebugCheck(!act->CastFunction);
-           act->CastFunction(caster, spell, act, target, x, y);
+           cont = cont && act->CastFunction(caster, spell, act, target, x, y);
            act=act->Next;
        }
+       //
+       //      Spells like blizzard are casted again.
+       //      This is sort of confusing, we do the test again, to
+       //      check if it will be possible to cast again. Otherwise,
+       //      when you're out of mana the caster will try again ( do the
+       //      anim but fail in this proc.
+       //
+       if (spell->RepeatCast && cont) {
+           return CanCastSpell(caster, spell, target, x, y);
+       }
     }
-    return 0;
+    //
+    // Can't cast, STOP.
+    //
+    return 0; 
 }
 
 /*
Index: stratagus/src/include/spells.h
diff -u stratagus/src/include/spells.h:1.36 stratagus/src/include/spells.h:1.37
--- stratagus/src/include/spells.h:1.36 Tue Oct 28 07:08:30 2003
+++ stratagus/src/include/spells.h      Tue Oct 28 20:55:32 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: spells.h,v 1.36 2003/10/28 12:08:30 n0body Exp $
+//     $Id: spells.h,v 1.37 2003/10/29 01:55:32 n0body Exp $
 
 #ifndef __SPELLS_H__
 #define __SPELLS_H__
@@ -252,7 +252,8 @@
     
     int Range;                         /// Max range of the target.
 #define INFINITE_RANGE 0xFFFFFFF
-    int ManaCost;                      /// required mana for each cast
+    int ManaCost;                      /// Required mana for each cast.
+    int RepeatCast;                    /// If the spell will be cast again 
until out of targets.
 
     int DependencyId;                  /// Id of upgrade, -1 if no upgrade 
needed for cast the spell.
     ConditionInfo *Condition;          /// Conditions to cast the spell. 
(generic (no test for each target))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]