Difference between revisions of "User:AVS/Spellcasting"

From VCMI Project Wiki
Jump to: navigation, search
(Configuration)
(Configuration)
Line 80: Line 80:
 
"spellName":
 
"spellName":
 
{
 
{
 +
//numeric id of spell requred only for original spells, not recommended for new spells
 
"id": 0,
 
"id": 0,
 
"effect": 0,
 
"effect": 0,
 
"anim": -1,
 
"anim": -1,
 
"ranges": [ "X", "X", "X", "X" ],
 
"ranges": [ "X", "X", "X", "X" ],
 +
 +
//flags string array of:
 +
// damage - spell does damage (direct or indirect)
 +
// offensive - direct damage
 +
// rising - rising spell
 +
// mind //deprecated
 +
// summoning //todo:
 
"flags" : ["flag1", "flag2"],
 
"flags" : ["flag1", "flag2"],
"immunity": ["BONUS_NAME", ...],
+
//string array of bonus names, any one of these bonus grants immunity
"limit": ["BONUS_NAME", ...],
+
"immunity": ["BONUS_NAME", ...],
 +
 
 +
//string array of bonus names, presence of all bonuses required to be affected by
 +
"limit": ["BONUS_NAME", ...],
 +
 
 +
 
 
"effectsCommon": [{bonus format} ...], //for all spell levels
 
"effectsCommon": [{bonus format} ...], //for all spell levels
 
"effects": [ //for particular lelel, merged with effectsCommon
 
"effects": [ //for particular lelel, merged with effectsCommon

Revision as of 12:42, 20 January 2013

Entities

Caster

  1. Hero
  2. Creature
  3. (*) Scriptable virtual. Fully customizable by scripts.

ISpellCaster - public interface.

Target

  1. Object - any object in adv map. (f.e. scuttle boat).
  2. (?)Tile - any tile on map (f.e. DD)
  3. Battle creature
  4. Battle obstacle
  5. Battle hex
  6. (*) Battle hero.
  • there can be multiple targets.
  • on adv map, if no target then it assumed hero itself (f.e. vision, viewXXX ).
  • (->) target selection configuration use selector semantic similar to bonus system.

ISpellTarger - public interface.

Spell

Common interface

Used by GUI, AI, (?) Server. Readonly.

Service-oriented design version

Use singleton Handler and methods accepting TSpell as first parameter.

  • (+) script-frendly
  • (+) low coupling

OO design version with proxy

  1. CSpellInfo - proxy class. Constructs from TSpell.
  • (+) more readable
  • (+) low coupling

OO design version

  1. CSpell -
  2. CSpellHandler
  • (+) current version
  • (-) higher coupling

GUI related interface

used by GUI

  • animation
  • sound
  • description for spellbook
  • icon for spellbook, scroll etc.
  • (+) inherit all from common interface.

OO design version with proxy

  1. SpellView - proxy class. Header file public.
  2. SpellViewHandler - singleton class (hidden) Header file private: used only by implementation of SpellView and CGI.

Server interface

used by server-side handlers

  • applying effects
    • do damage
    • set timed effects
    • adv map logic

Configuration

[Todo] Spell format

{
	"spells":
	{
		"spellName":
		{
			//numeric id of spell requred only for original spells, not recommended for new spells
			"id": 0,
			"effect": 0,
			"anim": -1,
			"ranges": [ "X", "X", "X", "X" ],

			//flags string array of:
			//		damage - spell does damage (direct or indirect)
			//		offensive - direct damage
			//		rising - rising spell
			//		mind //deprecated
			//		summoning //todo:
			"flags" : ["flag1", "flag2"],
			//string array of bonus names, any one of these bonus grants immunity
			"immunity": ["BONUS_NAME", ...],

			//string array of bonus names, presence of all bonuses required to be affected by
			"limit": ["BONUS_NAME", ...],


			"effectsCommon": [{bonus format} ...], //for all spell levels
			"effects": [ //for particular lelel, merged with effectsCommon
				[{bonus format} ... ], //no skill
				[{bonus format} ... ], //basic
				[{bonus format} ... ], //adv
				[{bonus format} ... ]  //expert
			]

		}
	}
}