From d8909d9b2cf29f45c025fb93fc1df94ec1a40854 Mon Sep 17 00:00:00 2001
From: Jedzkie <jedzkie13@rocketmail.com>
Date: Sun, 22 Nov 2015 15:49:51 +0800
Subject: SC Update:  - Added 'Eden Crystal Synthesis' statuses.  - Added
 'Geffen Magic Tournament' statuses. Note: their sc_config.txt are not yet
 implemented, needs more information on official servers.

---
 db/const.txt     | 11 ++++++++++
 db/sc_config.txt | 11 ++++++++++
 src/map/skill.c  |  4 ++++
 src/map/status.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 src/map/status.h | 11 ++++++++++
 5 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/db/const.txt b/db/const.txt
index 332960b9f..4b1ea95a5 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -1300,6 +1300,17 @@ SC_ARMORSCROLL	598
 SC_FREYJASCROLL	599
 SC_SOULSCROLL	600
 
+// Eden Crystal Synthesis
+SC_QUEST_BUFF1	601
+SC_QUEST_BUFF2	602
+SC_QUEST_BUFF2	603
+
+// Geffen Magic Tournament
+SC_GEFFEN_MAGIC1	604
+SC_GEFFEN_MAGIC2	605
+SC_GEFFEN_MAGIC3	606
+SC_FENRIR_CARD	607
+
 e_gasp	0
 e_what	1
 e_ho	2
diff --git a/db/sc_config.txt b/db/sc_config.txt
index 8a55fb45d..65e24e4e8 100644
--- a/db/sc_config.txt
+++ b/db/sc_config.txt
@@ -412,6 +412,17 @@ SC_ARMORSCROLL, 90
 SC_FREYJASCROLL, 90
 SC_SOULSCROLL, 90
 
+// Eden Crystal Synthesis [Needs more info]
+//SC_QUEST_BUFF1, ??
+//SC_QUEST_BUFF2, ??
+//SC_QUEST_BUFF3, ??
+
+// Geffen Magic Tournament [Needs more info]
+//SC_GEFFEN_MAGIC1, ??
+//SC_GEFFEN_MAGIC2, ??
+//SC_GEFFEN_MAGIC3, ??
+//SC_FENRIR_CARD, ??
+
 // Guild Auras should not be saved
 SC_LEADERSHIP,78
 SC_GLORYWOUNDS,78
diff --git a/src/map/skill.c b/src/map/skill.c
index 8a782fc9a..b20e25eb1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14743,6 +14743,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
 		}
 		if (sc->data[SC_MYSTICSCROLL])
 			VARCAST_REDUCTION(sc->data[SC_MYSTICSCROLL]->val1);
+			
 		// Fixed cast reduction bonuses
 		if( sc->data[SC__LAZINESS] )
 			fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
@@ -14755,6 +14756,9 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
 			if (radius_lv)
 				fixcast_r = max(fixcast_r, (status_get_int(bl) + status->get_lv(bl)) / 15 + radius_lv * 5); // [{(Caster?s INT / 15) + (Caster?s Base Level / 15) + (Radius Skill Level x 5)}] %
 		}
+		if (sc->data[SC_FENRIR_CARD])
+			fixcast_r = max(fixcast_r, sc->data[SC_FENRIR_CARD]->val2);
+
 		// Fixed cast non percentage bonuses
 		if( sc->data[SC_MANDRAGORA] )
 			fixed += sc->data[SC_MANDRAGORA]->val1 * 500;
diff --git a/src/map/status.c b/src/map/status.c
index 2e5eb5392..90a2531fc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -827,6 +827,17 @@ void initChangeTables(void) {
 	status->dbs->IconChangeTable[SC_ACARAJE] = SI_ACARAJE;
 	status->dbs->IconChangeTable[SC_TARGET_ASPD] = SI_TARGET_ASPD;
 	
+	// Eden Crystal Synthesis
+	status->dbs->IconChangeTable[SC_QUEST_BUFF1] = SI_QUEST_BUFF1;
+	status->dbs->IconChangeTable[SC_QUEST_BUFF2] = SI_QUEST_BUFF2;
+	status->dbs->IconChangeTable[SC_QUEST_BUFF3] = SI_QUEST_BUFF3;
+	
+	// Geffen Magic Tournament
+	status->dbs->IconChangeTable[SC_GEFFEN_MAGIC1] = SI_GEFFEN_MAGIC1;
+	status->dbs->IconChangeTable[SC_GEFFEN_MAGIC2] = SI_GEFFEN_MAGIC2;
+	status->dbs->IconChangeTable[SC_GEFFEN_MAGIC3] = SI_GEFFEN_MAGIC3;
+	status->dbs->IconChangeTable[SC_FENRIR_CARD] = SI_FENRIR_CARD;
+	
 	// Mercenary Bonus Effects
 	status->dbs->IconChangeTable[SC_MER_FLEE] = SI_MER_FLEE;
 	status->dbs->IconChangeTable[SC_MER_ATK] = SI_MER_ATK;
@@ -1043,10 +1054,22 @@ void initChangeTables(void) {
 	status->dbs->ChangeFlagTable[SC_ALL_RIDING] = SCB_SPEED;
 	status->dbs->ChangeFlagTable[SC_WEDDING] = SCB_SPEED;
 
-	status->dbs->ChangeFlagTable[SC_MTF_ASPD] = SCB_ASPD|SCB_HIT;
+	status->dbs->ChangeFlagTable[SC_MTF_ASPD] = SCB_ASPD | SCB_HIT;
 	status->dbs->ChangeFlagTable[SC_MTF_MATK] = SCB_MATK;
 	status->dbs->ChangeFlagTable[SC_MTF_MLEATKED] |= SCB_ALL;
-
+	
+	// Eden Crystal Synthesis
+	status->dbs->ChangeFlagTable[SC_QUEST_BUFF1] |= SCB_BATK | SCB_MATK;
+	status->dbs->ChangeFlagTable[SC_QUEST_BUFF2] |= SCB_BATK | SCB_MATK;
+	status->dbs->ChangeFlagTable[SC_QUEST_BUFF3] |= SCB_BATK | SCB_MATK;
+	
+	// Geffen Magic Tournament
+	status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC1] |= SCB_ALL;
+	status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC2] |= SCB_ALL;
+	status->dbs->ChangeFlagTable[SC_GEFFEN_MAGIC3] |= SCB_ALL;
+	status->dbs->ChangeFlagTable[SC_FENRIR_CARD] |= SCB_MATK | SCB_ALL;
+	
+	// Costume
 	status->dbs->ChangeFlagTable[SC_MOONSTAR] |= SCB_NONE;
 	status->dbs->ChangeFlagTable[SC_SUPER_STAR] |= SCB_NONE;
 	status->dbs->ChangeFlagTable[SC_STRANGELIGHTS] |= SCB_NONE;
@@ -2996,6 +3019,21 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
 		}
 		if (sc->data[SC_IMMUNITYSCROLL])
 			sd->subele[ELE_NEUTRAL] += sd->subele[ELE_NEUTRAL] * sc->data[SC_IMMUNITYSCROLL]->val1 / 100;
+		
+		// Geffen Magic Tournament
+		if (sc->data[SC_GEFFEN_MAGIC1]) {
+			sd->right_weapon.addrace[RC_DEMIHUMAN] += sc->data[SC_DISTRUCTIONSCROLL]->val1;
+			sd->left_weapon.addrace[RC_DEMIHUMAN] += sc->data[SC_DISTRUCTIONSCROLL]->val1;	
+		}
+		if (sc->data[SC_GEFFEN_MAGIC2])
+			sd->magic_addrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC2]->val1;
+		if (sc->data[SC_GEFFEN_MAGIC3]) {
+#ifdef RENEWAL
+			sd->race_tolerance[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC3]->val1;
+#else
+			sd->subrace[RC_DEMIHUMAN] += sc->data[SC_GEFFEN_MAGIC3]->val1;
+#endif
+		}	
 	}
 	status_cpy(&sd->battle_status, bstatus);
 
@@ -4588,6 +4626,14 @@ unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc,
 		batk -= batk * sc->data[SC__ENERVATION]->val2 / 100;
 	if(sc->data[SC_SATURDAY_NIGHT_FEVER])
 		batk += 100 * sc->data[SC_SATURDAY_NIGHT_FEVER]->val1;
+		
+	// Eden Crystal Synthesis
+	if (sc->data[SC_QUEST_BUFF1])
+		batk += sc->data[SC_QUEST_BUFF1]->val1;
+	if (sc->data[SC_QUEST_BUFF2])
+		batk += sc->data[SC_QUEST_BUFF2]->val1;
+	if (sc->data[SC_QUEST_BUFF3])
+		batk += sc->data[SC_QUEST_BUFF3]->val1;
 
 	return (unsigned short)cap_value(batk,0,USHRT_MAX);
 }
@@ -4756,6 +4802,18 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc,
 		matk += matk * 25 / 100;
 	if (sc->data[SC_MYSTICSCROLL])
 		matk += matk * sc->data[SC_MYSTICSCROLL]->val1 / 100;
+		
+	// Eden Crystal Synthesis
+	if (sc->data[SC_QUEST_BUFF1])
+		matk += sc->data[SC_QUEST_BUFF1]->val1;
+	if (sc->data[SC_QUEST_BUFF2])
+		matk += sc->data[SC_QUEST_BUFF2]->val1;
+	if (sc->data[SC_QUEST_BUFF3])
+		matk += sc->data[SC_QUEST_BUFF3]->val1;
+		
+	// Geffen Magic Tournament
+	if (sc->data[SC_FENRIR_CARD])
+		matk += sc->data[SC_FENRIR_CARD]->val1;
 
 	return (unsigned short)cap_value(matk,0,USHRT_MAX);
 }
diff --git a/src/map/status.h b/src/map/status.h
index a0fcde988..723e95a53 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -759,6 +759,17 @@ typedef enum sc_type {
 	SC_ARMORSCROLL,
 	SC_FREYJASCROLL,
 	SC_SOULSCROLL, // 600
+	
+	// Eden Crystal Synthesis
+	SC_QUEST_BUFF1,
+	SC_QUEST_BUFF2,
+	SC_QUEST_BUFF3,
+	
+	// Geffen Magic Tournament
+	SC_GEFFEN_MAGIC1,
+	SC_GEFFEN_MAGIC2,
+	SC_GEFFEN_MAGIC3,
+	SC_FENRIR_CARD,
 
 	SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
 } sc_type;
-- 
cgit v1.2.3-70-g09d2