2
0
Эх сурвалжийг харах

Last part of hero specialities - support for peculiar enchants.

DjWarmonger 15 жил өмнө
parent
commit
4696d89d2e

+ 15 - 15
config/specials.txt

@@ -9,11 +9,11 @@
 7	1	0	0	10
 8	2	5	27	0
 9	6	3	41	0
-10	8	45	0	0
+10	8	0	45	0
 11	3	3	20	0
 12	1	0	0	8
 13	2	5	11	0
-14	8	48	0	0
+14	8	0	48	0
 15	10	350	6	0
 16	2	5	23	0
 17	1	0	0	16
@@ -23,7 +23,7 @@
 21	1	0	0	18
 22	1	0	0	24
 23	2	5	2	0
-24	8	55	1	0
+24	8	0	55	1
 25	3	3	37	0
 26	2	5	24	0
 27	2	5	27	0
@@ -45,7 +45,7 @@
 43	7	0	51	0
 44	1	0	0	34
 45	3	3	19	0
-46	8	53	0	0
+46	8	0	53	0
 47	10	350	6	0
 48	1	0	0	46
 49	1	0	0	52
@@ -58,9 +58,9 @@
 56	2	5	24	0
 57	3	3	22	0
 58	2	5	8	1
-59	8	45	0	0
+59	8	0	45	0
 60	10	1	3	0
-61	8	43	0	0
+61	8	0	43	0
 62	2	5	25	0
 63	3	3	21	0
 64	1	0	0	58
@@ -76,7 +76,7 @@
 74	2	5	25	0
 75	2	5	11	1
 76	3	39	0	3
-77	8	46	0	0
+77	8	0	46	0
 78	2	5	12	0
 79	10	350	6	0
 80	1	0	0	72
@@ -94,7 +94,7 @@
 92	2	5	11	1
 93	3	3	23	0
 94	10	1	4	0
-95	8	46	0	0
+95	8	0	46	0
 96	1	0	0	94
 97	1	0	0	146
 98	1	0	0	88
@@ -106,8 +106,8 @@
 105	2	5	25	0
 106	1	0	0	90
 107	2	5	2	0
-108	8	53	0	0
-109	8	44	0	0
+108	8	0	53	0
+109	8	0	44	0
 110	2	5	25	0
 111	2	5	11	1
 112	10	1	5	0
@@ -122,7 +122,7 @@
 121	2	5	8	1
 122	2	2	5	1
 123	2	5	27	1
-124	8	46	0	0
+124	8	0	46	0
 125	2	5	25	0
 126	2	5	24	0
 127	2	5	11	1
@@ -145,11 +145,11 @@
 134	4	2	3	114
 135	4	2	1	115
 136	5	100	13	0
-137	8	53	0	0
+137	8	0	53	0
 138	5	50	15	0
-139	8	46	0	0
-140	8	43	0	0
-141	8	47	0	0
+139	8	0	46	0
+140	8	0	43	0
+141	8	0	47	0
 142	10	350	6	0
 143	10	350	6	0
 144	12	2	0	0

+ 2 - 1
hch/CObjectHandler.cpp

@@ -1102,7 +1102,8 @@ void CGHeroInstance::initObj()
 				break;
 			case 8://peculiar spells - enchantments
 				bonus.type = Bonus::SPECIAL_PECULIAR_ENCHANT;
-				bonus.subtype = it->subtype; //0, 1 for Coronius
+				bonus.subtype = it->subtype; //spell id
+				bonus.additionalInfo = it->additionalinfo;//0, 1 for Coronius
 				speciality.bonuses.push_back (bonus);
 				break;
 			case 9://upgrade creatures

+ 30 - 0
lib/CGameState.cpp

@@ -758,6 +758,31 @@ const Bonus * CStack::getEffect( ui16 id, int turn /*= 0*/ ) const
 void CStack::stackEffectToFeature(BonusList & sf, const Bonus & sse)
 {
 	si32 power = VLC->spellh->spells[sse.id].powers[sse.val];
+	Bonus * bonus = getBonus(Selector::typeSybtype(Bonus::SPECIAL_PECULIAR_ENCHANT, sse.id));
+	if (bonus)
+	{
+		switch(bonus->additionalInfo)
+		{
+			case 0: //normal
+				switch(type->level)
+				{
+					case 1: case 2:
+						power += 3; //it doesn't necessarily make sense for some spells, use it wisely
+					break;
+					case 3: case 4:
+						power += 2;
+					break;
+					case 5: case 6:
+						power += 1;
+					break;
+				}
+			break;
+			case 1: //only Coronius as yet
+				power = std::max(5 - type->level, 0);
+			break;
+		}
+	}
+
 	switch(sse.id)
 	{
 	case 27: //shield 
@@ -860,6 +885,11 @@ void CStack::stackEffectToFeature(BonusList & sf, const Bonus & sse)
 		sf.back().id = sse.id;
 		break;
 	case 55: //slayer
+		if (bonus) //Coronius
+		{
+			sf.push_back(featureGenerator(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK, power, sse.turnsRemain));
+			sf.back().id = sse.id;
+		}
 		sf.push_back(featureGenerator(Bonus::SLAYER, 0, sse.val, sse.turnsRemain));
 		sf.back().id = sse.id;
 		break;