stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus doc/ccl/magic.html src/clone/mainloop...


From: Crestez Leonard
Subject: [Stratagus-CVS] stratagus doc/ccl/magic.html src/clone/mainloop...
Date: Thu, 30 Oct 2003 15:22:51 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Crestez Leonard <address@hidden>        03/10/30 15:22:51

Modified files:
        doc/ccl        : magic.html 
        src/clone      : mainloop.c unit.c 
        src/include    : stratagus.h 
        src/video      : deco.c 

Log message:
        Completed spell (added conditions and autocast) documentation.

Patches:
Index: stratagus/doc/ccl/magic.html
diff -u stratagus/doc/ccl/magic.html:1.7 stratagus/doc/ccl/magic.html:1.8
--- stratagus/doc/ccl/magic.html:1.7    Tue Oct 28 20:55:31 2003
+++ stratagus/doc/ccl/magic.html        Thu Oct 30 15:22:47 2003
@@ -17,9 +17,9 @@
 ----    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ----    02111-1307, USA.
 -->
-    <title>Stratagus Configuration Language Description: Tileset</title>
+    <title>Stratagus Configuration Language Description: Magic</title>
     <meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
-    <meta name="Author" content="address@hidden">
+    <meta name="Author" content="address@hidden">
     <meta name="Keyword" content="ccl,magic,spells">
     <meta name="Description" content="">
 </head>
@@ -241,8 +241,115 @@
 If the unit dies however the caster will stop. (Some spells get casted until
 there is no more mana left).
 </dd>
+<dt>conditions</dt>
+<dd>This is the condition for being able to cast the spell. Think of it as a 
+function that takes an unit as a parameter and return either yes or no 
depending
+on the unit properties. Here is how a condition looks like:
+<pre>'condition '(
+  building false
+  max-slow-ticks 10)</pre>
+Here are the supported parameters:<p>
+<dl>
+    <dt>building</dt>
+    <dd>This is one of the bool parameters (can't think of a better name). It 
is
+    followed by true, false or only. Imagine this as a question, is the target 
a
+    building? The answer is yes/no. A "true" parameter makes it always pass(and
+    it's the default.), "false" parameter passes when the answer is NO, and 
"only"
+    passes only when the answer is yes.<br>
+    It doesn't really makes sense to ever say true, since you might just as 
well
+    ommit it. "building false" means the spell won't work on buildings. 
"building 
+    only" will make a spell that works only on buildings (can't think of any 
though).
+    This syntax is used for more that "building"
+    </dd>
+    <dt>coward</dt>
+    <dd>This is a bool parameter too, just like building. I specifies the 
behaviour
+    for cowards, unit's that don't attack by themselves. For example you 
should not
+    cast an offensive buff (like bloodlust) on non-combat units.
+    </dd>
+    <dt>alliance</dt>
+    <dd>This is a bool parameter too, just like building. I specifies the 
behaviour
+    for allied units. Your own units are considered allied too. For instance 
you
+    should only cast healing on your own units. 
+    </dd>
+    <dt>self</dt>
+    <dd>This is a bool parameter too, just like building. I it a bit more 
special,
+    since it specifies the behaviour for casting on yourself. <b>A LOT</b> of
+    spells specify "self false", to disallow casting on yourself.
+    </dd>
+    <dt>bool-flags</dt>
+    <dd>There is no parameter called bool-flags. You can however use flags 
defined
+    by <a href="unittype.html#define-bool-flags">define-bool-flags</a> just 
like a
+    bool parameter. For instance "organic only" will make a spell work only on
+    units marked with the organic flag.
+    </dd>
+    <dt>min-hp-percent</dt>
+    <dd>Minimum hp percent of the target. If not specified the minimum is 
around -10
+    You can use this to avoid casting damage spells on enemies that are dying 
anyway.
+    </dd>
+    <dt>max-hp-percent</dt>
+    <dd>Maximum hp percent of the target. If not specified the maximum is 
around 1000.
+    For instance you can use this to avoid healing units that are not injured.
+    </dd>
+    <dt>min-mana-percent</dt>
+    <dd>Minimum mana percent of the target. If not specified the minimum is 
around -10
+    You can use this to avoid spells like mana drain on units that are empty. 
+    </dd>
+    <dt>max-mana-percent</dt>
+    <dd>Maximum mana percent of the target. If not specified the maximum is 
around 1000
+    For instance you can use this to avoid restoring mana to units that are 
full.
+    </dd>
+    <dt>max-slow-ticks</dt>
+    <dd>Followed by a number, to avoid casting slow on an unit that is already 
slowed down.
+    </dd>
+    <dt>max-haste-ticks</dt>
+    <dd>Followed by a number, to avoid casting haste on an unit that is 
already hasted.
+    </dd>
+    <dt>max-bloodlust-ticks</dt>
+    <dd>Followed by a number, to avoid casting bloodlust on an unit that 
already has it.
+    </dd>
+    <dt>max-invisibility-ticks</dt>
+    <dd>Followed by a number, to avoid casting invisibility on an unit that 
already has it.
+    </dd>
+    <dt>max-invincibility-ticks</dt>
+    <dd>Followed by a number, to avoid casting invincibility on an unit that 
already has it.
+    </dd>
+</dl>
+</dd><p>
+<dt>autocast</dt>
+<dd>Autocast works very closely with conditions. Here is the syntax:
+<pre>'autocast (range x condition(whatever) )</pre>
+It functions by selecting every unit in range and trying to check of they fit 
the
+condition. If they do, the spell is casted. Of course, this is a very primitive
+mechanism, but it works for simple spells like heal. As you might have 
noticed, some
+of the finer restrictions in conditions are designed for autocast (like not 
casting
+buffs on cowards). Autocasting position target spells is not supported, sorry.
+Here is a formal list of parameters:
+<dl>
+    <dt>range</dt>
+    <dd>The range in which autocast runs. I think it's square?
+    </dd>
+    <dt>combat</dt>
+    <dd>This is a bool parameter, like in condition. It's autocast-specific 
and NOT
+    part of conditions due to technical considerations. Combat is not 
unit-specific,
+    it only depends on caster location. combat mode is when there are 
non-coward
+    enemy units in range. most offensive spells obviousely only should be used 
in
+    combat. (can you say offensive buffs?)
+    </dd>
+    <dt>condition</dt>
+    <dd>This is followed by a list exactly like in 'condition. As it was said
+    before, this is evaluated for each and every unit in range, and if a unit
+    passes, the spell gets casted.
+    </dd>
+</dl>
+</dd>
+<dt>ai-cast</dt>
+<dd>This is identical to autocast in syntax. It's used by the AI (computer 
controller
+player) rather then by a human players units. In general this should be a 
little better
+than autocast (and make human players think some more). There no reason to 
repeat the
+syntax of autocast here.
+</dd><p>
 <dt>action</dt>
-<dd>The effect of the spells. This comes in the following form:
+<dd>The effect of the spells. You can add multiple actions, here is the syntax:
 <pre>'action '((operation-name-1 parameters ... )
           (operation-name-2 parameters ... )
              ...
@@ -494,7 +601,7 @@
 
 
 <hr>
-Last changed: $Id: magic.html,v 1.7 2003/10/29 01:55:31 n0body Exp $<br>
+Last changed: $Id: magic.html,v 1.8 2003/10/30 20:22:47 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/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.152 
stratagus/src/clone/mainloop.c:1.153
--- stratagus/src/clone/mainloop.c:1.152        Wed Oct 29 22:46:02 2003
+++ stratagus/src/clone/mainloop.c      Thu Oct 30 15:22:48 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: mainloop.c,v 1.152 2003/10/30 03:46:02 n0body Exp $
+//     $Id: mainloop.c,v 1.153 2003/10/30 20:22:48 n0body Exp $
 
 //@{
 
@@ -381,8 +381,8 @@
     // Every to-be-drawn item added to this mechanism, can be handed by this
     // call.
     if (InterfaceState == IfaceStateNormal) {
-//     DecorationRefreshDisplay();
-       DecorationUpdateDisplay();
+       DecorationRefreshDisplay();
+//     DecorationUpdateDisplay();
     }
 
 #else
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.324 stratagus/src/clone/unit.c:1.325
--- stratagus/src/clone/unit.c:1.324    Wed Oct 29 22:46:02 2003
+++ stratagus/src/clone/unit.c  Thu Oct 30 15:22:49 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: unit.c,v 1.324 2003/10/30 03:46:02 n0body Exp $
+//     $Id: unit.c,v 1.325 2003/10/30 20:22:49 n0body Exp $
 
 //@{
 
@@ -1267,7 +1267,7 @@
 
     unit = (Unit*)data;
     DebugCheck(unit->Removed);
-    DebugCheck(!UnitVisibleOnScreen(unit));
+    //DebugCheck(!UnitVisibleOnScreen(unit));
 
     DrawUnit(unit);
 }
@@ -1284,7 +1284,7 @@
 
     unit = (Unit*)data;
     DebugCheck(unit->Removed);
-    DebugCheck(!UnitVisibleOnScreen(unit));
+    //DebugCheck(!UnitVisibleOnScreen(unit));
 
     DrawBuilding(unit);
 }
@@ -3743,7 +3743,7 @@
     int RunStart;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.324 2003/10/30 03:46:02 
n0body Exp $\n\n");
+    CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.325 2003/10/30 20:22:49 
n0body Exp $\n\n");
 
     //
     // Local variables
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.25 
stratagus/src/include/stratagus.h:1.26
--- stratagus/src/include/stratagus.h:1.25      Wed Oct 29 22:46:02 2003
+++ stratagus/src/include/stratagus.h   Thu Oct 30 15:22:50 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: stratagus.h,v 1.25 2003/10/30 03:46:02 n0body Exp $
+//     $Id: stratagus.h,v 1.26 2003/10/30 20:22:50 n0body Exp $
 
 #ifndef __STRATAGUS_H__
 #define __STRATAGUS_H__
Index: stratagus/src/video/deco.c
diff -u stratagus/src/video/deco.c:1.12 stratagus/src/video/deco.c:1.13
--- stratagus/src/video/deco.c:1.12     Wed Oct 29 22:46:03 2003
+++ stratagus/src/video/deco.c  Thu Oct 30 15:22:51 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: deco.c,v 1.12 2003/10/30 03:46:03 n0body Exp $
+//     $Id: deco.c,v 1.13 2003/10/30 20:22:51 n0body Exp $
 
 //@{
 
@@ -903,8 +903,9 @@
 static void DrawArea( int x, int y, int w, int h,
                       void *data, void (*drawclip)(void *data) )
 {
-  SetClipping( x, y, x+w-1, y+h-1 );
-  drawclip( data );
+//    SetClipping( 0, 0, 640, 480 );
+    SetClipping( x, y, x+w-1, y+h-1 );
+    drawclip( data );
 }
 
 /**
@@ -1458,6 +1459,11 @@
 {
     Deco *d;
     int i;
+#ifdef DEBUG 
+    //  Count total decos.
+    int numdeco;
+    numdeco = 0;
+#endif
 
     // save clip rectangle
     PushClipping();
@@ -1466,8 +1472,12 @@
     for (i = 0; i < LevCount; i++) {
        for (d = dhead[i]; d; d = d->nxt) {
            DrawArea(d->x, d->y, d->w, d->h, d->data, d->drawclip);
+#ifdef DEBUG
+           numdeco++;
+#endif
        }
     }
+    DebugLevel0Fn("Drawn a total amount of %d decos in redraw\n" _C_ numdeco);
 
     Invalidate();
 




reply via email to

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