Json configuration for spells


#41

In attachment.

  1. In spell Champions Marsch propagator HERO is commented.
    So when spell is cast, green counter appears, but morale is not increased. And in creatue window there is no icon of active spell.
    In spell Bard Song propagator is not commented, so luck is applied.
  2. These hymns are not assigned to any magic school, so in magic book this is corruption - there are only 4 defs for spell level indicatings (for each school), so it goes outside of array schoolBorders] and takes cadre from another def (Schools.def) that should not be there.
    I think there must be check - is spell school is not set, that do not try to load graphics from schoolBorders.
    hymns-mod.zip (61.8 KB)

#42

In theory it is of course possible, but a bit harder than trivial :). Spell school is not just required primary skill

struct SpellSchoolInfo
{
	ESpellSchool id; //backlink
	Bonus::BonusType damagePremyBonus;
	Bonus::BonusType immunityBonus;	
	std::string jsonName;
	SecondarySkill::ESecondarySkill skill;
	Bonus::BonusType knoledgeBonus;			
};

(non including interface logic).


#43

Or then allow some time to add new Spell Schools Info with Secodary Skills.
To change AIR_SPELL_DMG_PREMY to SPELL_DMG_PREMY with “subtype”:"spellSchool.air"
and so on.
Magic Book problem

  1. Leave it be - 4 elemental magics will have their own pages, and all other schools will go to united combat spells pages.
  2. Move magic book to json, so user can make other schools pages.
    Or cause, it will require a lot of work, don’t expect it to 1.0 version.
    It will require to move secondary skills bonuses to json also.

#44

This may be implemented in part 6 (current is 4; 5 will be about adventure spells) of spell refactoring.


#45

Would You Implement Reinforcements Spell?
it allows to teleport creatures from Town to Hero which is not visiting it.

there is mod in ERA which replaces Disguise by Reinforcements, but we may add it as separate spell.


#46

My plan after current refactoring of spells is implement scripting.


#47

That’s really great news :smiley:.


#48

Adventure map spells are working, this is really great.
But I have question.

For example, this spell (and all adventure spells rising some value) gives + to morale. I cast it 3 times, and it gives +6 morale on expert. I want to allow only 1 cast per turn for hero (or I cast it 20 times and will get +60 morale :mrgreen: till end of turn.
I tried to use “counters” but it doesn’t help. Is there is a way to prevent it from multiple casts?

{
	"armyPrayer":
	{
		"type": "adventure", 
		"name": "Army Prayer",
		"school":
		{
			"air": true,
			"earth": false,
			"fire": false,
			"water": false
		},
		"level": 3,
		"power": 10,
		
		"defaultGainChance": 3, 
		"gainChance":
		{
			"castle": 4
		},
 
		//counterstrike animation?
	"counters": {"spell.armyPrayer":true},

 
		"flags" : {"indifferent": true,"positive":true},
 
		//graphics - OPTIONAL; object;
		"graphics":
		{
			"iconBook": "!Map-spells/ArmyPrayer/back0.bmp",
			"iconScroll": "!Map-spells/ArmyPrayer/back1.bmp",
			"iconScenarioBonus": "!Map-spells/ArmyPrayer/back2.bmp",
			"iconEffect": "!Map-spells/ArmyPrayer/back3.bmp"
		},

		
		"targetType": "NO_TARGET",
 
		"levels":
		{
			"none":
			{
				"description": "Gives army +1 morale until end of turn.",
	 
				"cost": 8,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
				"targetModifier":{"smart":false},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 1,
						"duration": "ONE_DAY",
//						"propagator":"HERO"
					},
//					"morale":
//					{
//					"type":"MORALE",
//					"val":1,
//					"duration":"ONE_DAY"
//					}
				}
			},
			"basic":
			{
				"description": "Gives army +1 morale until end of turn.",
	 
				"cost": 7,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
				"targetModifier":{"smart":false},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 1,
						"duration": "ONE_DAY",
	//					"propagator":"HERO"
					},
//					"morale":
//					{
//					"type":"MORALE",
//					"val":1,
//					"duration":"ONE_DAY"
//					}
				}
			},
			"advanced":
			{
				"description": "Gives army +1 morale until end of turn.",
	 
				"cost": 6,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
				"targetModifier":{"smart":false},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 1,
						"duration": "ONE_DAY",
		//				"propagator":"HERO"
					},
//					"morale":
//					{
//					"type":"MORALE",
//					"val":1,
//					"duration":"ONE_DAY"
//					}
				}
			},
			"expert":
			{
				"description": "Gives army +1 morale until end of turn.",
	 
				"cost": 8,
				"power": 10,
				"aiValue": 5,
				"range": "X",
	
				"targetModifier":{"smart":false},
	 
				"effects":
				{
					"attacks":
					{
						"type": "MORALE",
						"val": 2,
						"duration": "ONE_DAY",
		//				"propagator":"HERO"
					},
//					"morale":
//					{
//					"type":"MORALE",
//					"val":1,
//					"duration":"ONE_DAY"
//					}
				}
			}
		}
	}
 
}

#49

I don’t think it’s possible yet as limit for Dimension Door is hardcoded.


#50

How about adding “castLimit”:n (limit of cast per day) to spell levels configuration?
It will help dimension door too…


#51
  1. maximum morale is +3
  2. this (configuration for adv spell) feature is not complete and anything may change.
  3. any suggestions for adventure spell configuration will be rejected until scripting will be implemented. Consider adventure spell configuration as internal engine feature an NOT intended for modding.

#52

That’s one cool feature, so i’ll play with it :mrgreen:
Can AI use these custom spells for adventure map?
As for me, I can limit spell casting by my will :sunglasses:


#53

VCAI isn’t capable of casting any adventure map spells. :frowning:


#54

Of course you may do what you want with adv spells, but please don`t complain about missing features :wink: But patches are always welcome :slight_smile:


#55

I hope I will finish my current hell of materials work in march, and will try to fix something.
I must remember GIT magic as well :sunglasses:

I plan to at least fix IMPROVED_NECROMANCY, so it will be configurable (user will write in “subtype” which creature to rise).


#56

By the way, what is with summoning spells?

I looked into sources, it seems that something is changed for summoning spells.
Is it already can be configured through json?
What bonus type goes for summoning, if implemented?


#57

I don`t have plans to implement summoning configuration right now. It will be part of second version of configuration format - kind of distant future (after json map format & scripting).


#58

It’s sad:-(


#59

By the way, seems like a bug.
In VCMI 0.97 this spell worked (repaired non-living things).
In last builds this spell on activation writes that it will affect no one.
Setting “smart”:true to false don’t help

{
	"repair":
	{
		"type": "combat", 
		"name": "Repair",
		"school":
		{
			"air": false,
			"earth": true,
			"fire": false,
			"water": false
		},
		"level": 4,
		"power": 30,
		"defaultGainChance": 3, 
		"gainChance":
		{
			"tower": 5
		},
 
		"animation":{
			"affect":"repair/repair"]
		},		
 
		"flags" : {"positive":true,"rising":true},
		
	//	"immunity":{"UNDEAD":true,"NON_LIVING":false},
 
		//flags structure of bonus names,any one of these bonus grants immunity
		"absoluteLimit":
		{
			"NON_LIVING" : true,
			"SIEGE_WEAPON" : true
		},
 		"limit":
		{
			"NON_LIVING" : true
		},
		//graphics - OPTIONAL; object;
		"graphics":
		{
			"iconBook": "repair/back0.bmp",
			"iconScroll": "repair/back1.bmp",
			"iconScenarioBonus": "repair/back2.bmp",
			"iconEffect": "repair/back3.bmp"
		},
		"sounds":
		{
			"cast":"spell_sounds/fixit"
		},
		"targetType" : "CREATURE",//_EXPERT_MASSIVE",
 
		"levels":
		{
			"none":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 0,
				"aiValue": 17,
				"range": "0",
				"targetModifier":{"smart":true}
			},
			"basic":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 200,
				"aiValue": 17,
				"range": "0",
				"targetModifier":{"smart":true}
				},
			"advanced":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 300,
				"aiValue": 18,
				"range": "0",
				"targetModifier":{"smart":true}
			},
			"expert":
			{
				"description": "Repairs mechanisms, non-living creatures and siege weapons.",
	 
				"cost": 35,
				"power": 400,
				"aiValue": 19,
				"range": "0",
				"targetModifier":{"smart":true}
			}
		}
	}
 
}

And how about summoning spells?
I personally wait them more than one year.
Let’s make them same as summoning elementals (only one type of summoning spells can be cast after first casting), passing through “subtype” type of monsters, and deciding quantity of monsters through “power”/hitPoints.
Just make them already, please. :unamused:


#60

By the way, made spell, that lowers stack speed to 0.

"type":"STACKS_SPEED",
"valueType":"PERCENT_TO_ALL",
"addInfo":100,
"val":-100,
"duration": "UNITL_BEING_ATTACKED"

It works well (unit not moving), but on screen error console message shows (in green font) - look image.
It’s not an error, maybe just suppress error console on battle screen?