mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Introduced absolute specific spell immunity.
This commit is contained in:
		| @@ -1313,7 +1313,8 @@ | ||||
| 				"subtype" : 35, | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"val" : 0, | ||||
| 				"valueType" : "BASE_NUMBER" | ||||
| 				"valueType" : "BASE_NUMBER", | ||||
| 				"addInfo" : 1 | ||||
| 			} | ||||
| 		], | ||||
| 		"index" : 92, | ||||
| @@ -1819,7 +1820,8 @@ | ||||
| 				"subtype" : "spell.armageddon", | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"val" : 0, | ||||
| 				"valueType" : "BASE_NUMBER" | ||||
| 				"valueType" : "BASE_NUMBER", | ||||
| 				"addInfo" : 1 | ||||
| 			}, | ||||
| 			{ | ||||
| 				"subtype" : "primSkill.attack", | ||||
|   | ||||
| @@ -9,12 +9,14 @@ | ||||
| 			"blindImmunity" :  | ||||
| 			{ | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"subtype" : "spell.blind" | ||||
| 				"subtype" : "spell.blind", | ||||
| 				"addInfo" : 1 | ||||
| 			}, | ||||
| 			"petrifyImmunity" :  | ||||
| 			{ | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"subtype" : "spell.stoneGaze" | ||||
| 				"subtype" : "spell.stoneGaze", | ||||
| 				"addInfo" : 1 | ||||
| 			} | ||||
| 		}, | ||||
| 		"upgrades": ["infernalTroglodyte"], | ||||
| @@ -42,12 +44,14 @@ | ||||
| 			"blindImmunity" :  | ||||
| 			{ | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"subtype" : "spell.blind" | ||||
| 				"subtype" : "spell.blind", | ||||
| 				"addInfo" : 1 | ||||
| 			}, | ||||
| 			"petrifyImmunity" :  | ||||
| 			{ | ||||
| 				"type" : "SPELL_IMMUNITY", | ||||
| 				"subtype" : "spell.stoneGaze" | ||||
| 				"subtype" : "spell.stoneGaze", | ||||
| 				"addInfo" : 1 | ||||
| 			} | ||||
| 		}, | ||||
| 		"graphics" : | ||||
|   | ||||
| @@ -853,34 +853,42 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars | ||||
| 			case 'B': //Blind | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::BLIND; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'H': //Hypnotize | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::HYPNOTIZE; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'I': //Implosion | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::IMPLOSION; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'K': //Berserk | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::BERSERK; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'M': //Meteor Shower | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::METEOR_SHOWER; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'N': //dispell beneficial spells | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::DISPEL_HELPFUL_SPELLS; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'R': //Armageddon | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::ARMAGEDDON; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case 'S': //Slow | ||||
| 				b.type = Bonus::SPELL_IMMUNITY; | ||||
| 				b.subtype = SpellID::SLOW; | ||||
| 				b.additionalInfo = 0;//normal immunity | ||||
| 				break; | ||||
| 			case '6': | ||||
| 			case '7': | ||||
|   | ||||
| @@ -419,16 +419,25 @@ ESpellCastProblem::ESpellCastProblem CSpell::internalIsImmune(const ISpellCaster | ||||
| 			return ESpellCastProblem::STACK_IMMUNE_TO_SPELL; | ||||
| 	} | ||||
|  | ||||
| 	//spell-based spell immunity (only ANTIMAGIC in OH3) is treated as absolute | ||||
| 	std::stringstream cachingStr; | ||||
| 	cachingStr << "type_" << Bonus::LEVEL_SPELL_IMMUNITY << "source_" << Bonus::SPELL_EFFECT; | ||||
|  | ||||
| 	TBonusListPtr levelImmunitiesFromSpell = obj->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY).And(Selector::sourceType(Bonus::SPELL_EFFECT)), cachingStr.str());	 | ||||
|  | ||||
| 	if(levelImmunitiesFromSpell->size() > 0  &&  levelImmunitiesFromSpell->totalValue() >= level  &&  level) | ||||
| 	{ | ||||
| 		return ESpellCastProblem::STACK_IMMUNE_TO_SPELL; | ||||
| 		//spell-based spell immunity (only ANTIMAGIC in OH3) is treated as absolute | ||||
| 		std::stringstream cachingStr; | ||||
| 		cachingStr << "type_" << Bonus::LEVEL_SPELL_IMMUNITY << "source_" << Bonus::SPELL_EFFECT; | ||||
|  | ||||
| 		TBonusListPtr levelImmunitiesFromSpell = obj->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY).And(Selector::sourceType(Bonus::SPELL_EFFECT)), cachingStr.str());	 | ||||
|  | ||||
| 		if(levelImmunitiesFromSpell->size() > 0  &&  levelImmunitiesFromSpell->totalValue() >= level  &&  level) | ||||
| 		{ | ||||
| 			return ESpellCastProblem::STACK_IMMUNE_TO_SPELL; | ||||
| 		} | ||||
| 	} | ||||
| 	{ | ||||
| 		//SPELL_IMMUNITY absolute case | ||||
| 		std::stringstream cachingStr; | ||||
| 		cachingStr << "type_" << Bonus::SPELL_IMMUNITY << "subtype_" << id.toEnum() << "addInfo_1"; | ||||
| 		if(obj->hasBonus(Selector::typeSubtypeInfo(Bonus::SPELL_IMMUNITY, id.toEnum(), 1), cachingStr.str())) | ||||
| 			return ESpellCastProblem::STACK_IMMUNE_TO_SPELL; | ||||
| 	}	 | ||||
|  | ||||
| 	//check receptivity | ||||
| 	if (isPositive() && obj->hasBonusOfType(Bonus::RECEPTIVE)) //accept all positive spells | ||||
|   | ||||
		Reference in New Issue
	
	Block a user