Defensive Move Framework

Ok. For starters, the framework for defensive moves is pretty open, so it leaves a 
lot up to you to decide on standards etc - that also means that the bits of script 
etc in this file are just examples for you to get the general idea.

The basic idea is that the execute-script of the attackers move, will call a
function that in turn calls the defend-script of the defenders move. The 
defend-script will then return some data to the execute-script. Now the data can 
be whatever you want but i'd say a struct (or dictionary, array, etc) holding 
things like damage modifier, miss chance, etc... whatever you decide though. It 
will be important to come up for a standard for the data format though, so that 
each attack script can access each defend script easily.

Ok, here it is step-by-step. In the execute script we call a function from
metacombat.inc:

  var defense := MCMoveCalculateDefenseChanges( who, opponent, mov, moveData );

Now this function can optionally take a 5th parameter, which is 'etc' - this is 
incase you want to send anything to the defend-script (such as current damage 
rating, etc - whatever).

  var defense := MCMoveCalculateDefenseChanges( who, opponent, mov, moveData, etc );

Now, this function will find out the current move of the defender ('opponent'). 
Then it will check if their current move has a "script.defend" specified in 
moves.cfg - if it doesn't then the function will return 0. If it does then 
the "script.defend" will be run critical until it returns a value (which can 
be whatever you want). The "script.defend" script will receive all the above 
parameters in an array, ie:

  program example_defend( parameters )
    var who := parameters[1];
    var opponent := parameters[2];
    var mov := parameters[3];
    var moveData := parameters[4];
    var etc := parameters[5];

When this script is finished, you return whatever value you want (as discussed 
above), and it will be set to the value of the 'defense' variable in the execute 
script. From there, you can use the returned values to modify data (attack damage, 
hit location, injury chance, etc) according to the defense move.

If that didn't make sense or you need clarification on something, then just give 
me an ICQ.
-Sith

 -------------------------------------------------------------------------------------
    ...and this is what I decided to implement... (Firedancer)
 -------------------------------------------------------------------------------------
  
  defence script returns a struct with these properties:
  
      defense.animation                 integer, animation id of the defensive move
             .tcritical                 time in ms - how long the animation takes to the block
            
             .modifier                  integer, absolute value modifying the difficulty of the move
                                        (even a tricky evasive move is easy if the attacker moves dull...
                                         for less evasion would have done the job, but even an easy
                                         evasion will have a hard time blocking an attack from behind.)
                                         
             .evasiontype               block,parry,dodge or evade (evade is passive - no animation)
             .weapon                    the weapon the enemy blocks or parries with
             .notifrequired             -/scriptid, means the combat move must remove the blockmoves busy flag when done
                                        (if the script id is still the same then)

  at the same time on the moving person a paramter is stored to describe the move state
  
      #mccom.attack                     string, move name
            .movpos                     {x,y,z}, position of player when move started
                                                (most commands don't allow moving around)
                                                
            .blockactive                integer, how often the player can still block while this move duration
                                                 is running. If 0 he can only evade
            .evades                     integer, based on blockmove, starting by 0 this values increases.
                                                 the block move may give an evade bonus for the first few.
                                                 These evades are used after the blocks are used up, or if an
                                                 attack is done from behind.
            .busy                       -/scriptid, means the defener is blocking - can't block again for now
                                                 
            


  NOTE: the defence move does not do a skillcheck itself!!! 
        rather it notes down the attackers 