Преглед изворни кода

Changes to reduce the number of map cell types
- Pneuma now again works via status change (see r3969)
- removed unused CELL_SAFETYWALL
- removed custom CELL_REGEN, it just increased regen rate (r1192, r1518)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12005 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage пре 17 година
родитељ
комит
6bf267e60e
7 измењених фајлова са 23 додато и 51 уклоњено
  1. 4 0
      Changelog-Trunk.txt
  2. 6 8
      src/map/battle.c
  3. 0 11
      src/map/map.c
  4. 2 16
      src/map/map.h
  5. 7 13
      src/map/skill.c
  6. 3 3
      src/map/status.c
  7. 1 0
      src/map/status.h

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/01/03
+	* Changes to reduce the number of map cell types
+	- Pneuma now again works via status change (see r3969)
+	- removed unused CELL_SAFETYWALL
+	- removed custom CELL_REGEN, it just increased regen rate (r1192, r1518)
 	* Fixed npc unloading not clearing NPC touch cells (bugreport:595)	
 	* Map cell mechanism rewrite
 	- defined a data structure for map cells (replaces 3 various cell arrays)

+ 6 - 8
src/map/battle.c

@@ -287,15 +287,10 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
 
 	sc = status_get_sc(bl);
 
-	if((flag&(BF_MAGIC|BF_LONG)) == BF_LONG &&
-		map_getcell(bl->m, bl->x, bl->y, CELL_CHKPNEUMA) &&
-		skill_num != NPC_GUIDEDATTACK)
-		return 0;
-	
 	if (sc && sc->count) {
 		//First, sc_*'s that reduce damage to 0.
-		if (sc->data[SC_SAFETYWALL] && flag&BF_SHORT && skill_num != NPC_GUIDEDATTACK
-		) {
+		if( sc->data[SC_SAFETYWALL] && flag&BF_SHORT && skill_num != NPC_GUIDEDATTACK )
+		{
 			struct skill_unit_group *group = (struct skill_unit_group *)sc->data[SC_SAFETYWALL]->val3;
 			if (group) {
 				if (--group->val2<=0)
@@ -304,7 +299,10 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
 			}
 			status_change_end(bl,SC_SAFETYWALL,-1);
 		}
-	
+
+		if( sc->data[SC_PNEUMA] && (flag&(BF_MAGIC|BF_LONG)) == BF_LONG && skill_num != NPC_GUIDEDATTACK )
+			return 0;
+
 		if((sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON &&
 			!(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK) &&
 			rand()%100 < sce->val2)

+ 0 - 11
src/map/map.c

@@ -2176,16 +2176,10 @@ int map_getcellp(struct map_data* m,int x,int y,cell_t cellchk)
 		// base cell type checks
 		case CELL_CHKNPC:
 			return (cell.npc);
-		case CELL_CHKPNEUMA:
-			return (cell.pneuma);
-		case CELL_CHKSAFETYWALL:
-			return (cell.safetywall);
 		case CELL_CHKBASILICA:
 			return (cell.basilica);
 		case CELL_CHKLANDPROTECTOR:
 			return (cell.landprotector);
-		case CELL_CHKREGEN:
-			return (cell.regen);
 		case CELL_CHKICEWALL:
 			return (cell.icewall);
 		case CELL_CHKNOVENDING:
@@ -2235,13 +2229,8 @@ void map_setcell(int m,int x,int y,int cell)
 		case CELL_CLRICEWALL:       map[m].cell[j].icewall = 0;       break;
 		case CELL_SETBASILICA:      map[m].cell[j].basilica = 1;      break;
 		case CELL_CLRBASILICA:      map[m].cell[j].basilica = 0;      break;
-		case CELL_SETPNEUMA:        map[m].cell[j].pneuma = 1;        break;
-		case CELL_CLRPNEUMA:        map[m].cell[j].pneuma = 0;        break;
-		case CELL_SETSAFETYWALL:    map[m].cell[j].safetywall = 1;    break;
-		case CELL_CLRSAFETYWALL:    map[m].cell[j].safetywall = 0;    break;
 		case CELL_SETLANDPROTECTOR: map[m].cell[j].landprotector = 1; break;
 		case CELL_CLRLANDPROTECTOR: map[m].cell[j].landprotector = 0; break;
-		case CELL_SETREGEN:         map[m].cell[j].regen = 1;         break;
 		case CELL_SETNOVENDING:     map[m].cell[j].novending = 1;     break;
 		case CELL_CLRNOVENDING:     map[m].cell[j].novending = 0;     break;
 		default:

+ 2 - 16
src/map/map.h

@@ -1109,9 +1109,6 @@ enum _look {
 
 // CELLs for non-permanent cell-based effects (Pneuma, Basilica, Npcs, etc)
 #define CELL_NPC	0x1
-#define CELL_REGEN	0x2
-#define CELL_PNEUMA	0x4
-#define CELL_SAFETYWALL	0x8
 #define CELL_LANDPROTECTOR	0x10
 #define CELL_BASILICA	0x20
 #define CELL_NOVENDING	0x40
@@ -1132,9 +1129,6 @@ typedef enum {
 	CELL_CHKNOREACH,	// Same as NOPASS, but ignores the cell-stacking mod.
 
 	CELL_CHKNPC=0x10,	// タッチタイプのNPC(セルタイプ0x80フラグ)
-	CELL_CHKREGEN,		// cells that improve regeneration
-	CELL_CHKPNEUMA,
-	CELL_CHKSAFETYWALL,
 	CELL_CHKBASILICA,	// バジリカ(セルタイプ0x40フラグ)
 	CELL_CHKLANDPROTECTOR,
 	CELL_CHKICEWALL,
@@ -1148,14 +1142,9 @@ enum {
 	CELL_CLRNPC,
 	CELL_SETBASILICA,	// バジリカをセット
 	CELL_CLRBASILICA,	// バジリカをクリア
-	CELL_SETREGEN,		// set regen cell
-	CELL_SETLANDPROTECTOR, //Set/Clear Magnetic Earth
+	CELL_SETLANDPROTECTOR=0x15, //Set/Clear Magnetic Earth
 	CELL_CLRLANDPROTECTOR,
-	CELL_SETPNEUMA,
-	CELL_CLRPNEUMA,
-	CELL_SETSAFETYWALL,
-	CELL_CLRSAFETYWALL,
-	CELL_SETICEWALL,
+	CELL_SETICEWALL=0x1b,
 	CELL_CLRICEWALL,
 	CELL_SETNOVENDING,
 	CELL_CLRNOVENDING,
@@ -1172,9 +1161,6 @@ struct mapcell
 	// dynamic flags
 	unsigned char
 		npc : 1,
-		regen : 1,
-		pneuma : 1,
-		safetywall : 1,
 		landprotector : 1,
 		basilica : 1,
 		icewall : 1,

+ 7 - 13
src/map/skill.c

@@ -4191,7 +4191,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 				case SC_SMA:         case SC_SPEEDUP0:    case SC_NOCHAT:
 				case SC_ANKLE:       case SC_SPIDERWEB:   case SC_JAILED:
 				case SC_ITEMBOOST:   case SC_EXPBOOST:    case SC_LIFEINSURANCE:
-				case SC_BOSSMAPINFO:
+				case SC_BOSSMAPINFO: case SC_PNEUMA:
 					continue;
 				}
 				if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
@@ -6502,6 +6502,11 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
 			sc_start4(bl,type,100,sg->skill_lv,sg->group_id,(int)sg,0,sg->limit);
 		break;
 
+	case UNT_PNEUMA:
+		if (!sce)
+			sc_start4(bl,type,100,sg->skill_lv,sg->group_id,0,0,sg->limit);
+		break;
+
 	case UNT_WARP_WAITING:
 		if(bl->type==BL_PC){
 			struct map_session_data *sd = (struct map_session_data *)bl;
@@ -7057,6 +7062,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
 
 	switch(sg->unit_id){
 	case UNT_SAFETYWALL:
+	case UNT_PNEUMA:
 		if (sce)
 			status_change_end(bl,type,-1);
 		break;
@@ -9234,12 +9240,6 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
 	map_addblock(&unit->bl);
 
 	switch (group->skill_id) {
-	case AL_PNEUMA:
-		skill_unitsetmapcell(unit,AL_PNEUMA,group->skill_lv,CELL_SETPNEUMA);
-		break;
-	case MG_SAFETYWALL:
-		skill_unitsetmapcell(unit,MG_SAFETYWALL,group->skill_lv,CELL_SETSAFETYWALL);
-		break;
 	case SA_LANDPROTECTOR:
 		skill_unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_SETLANDPROTECTOR);
 		break;
@@ -9281,12 +9281,6 @@ int skill_delunit (struct skill_unit* unit)
 		map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),4);
 
 	switch (group->skill_id) {
-	case AL_PNEUMA:
-		skill_unitsetmapcell(unit,AL_PNEUMA,group->skill_lv,CELL_CLRPNEUMA);
-		break;
-	case MG_SAFETYWALL:
-		skill_unitsetmapcell(unit,MG_SAFETYWALL,group->skill_lv,CELL_CLRSAFETYWALL);
-		break;
 	case SA_LANDPROTECTOR:
 		skill_unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_CLRLANDPROTECTOR);
 		break;

+ 3 - 3
src/map/status.c

@@ -153,6 +153,7 @@ void initChangeTables(void)
 	add_sc(MG_FROSTDIVER, SC_FREEZE);
 	add_sc(MG_STONECURSE, SC_STONE);
 	add_sc(AL_RUWACH, SC_RUWACH);
+	add_sc(AL_PNEUMA, SC_PNEUMA);
 	set_sc(AL_INCAGI, SC_INCREASEAGI, SI_INCREASEAGI, SCB_AGI|SCB_SPEED);
 	set_sc(AL_DECAGI, SC_DECREASEAGI, SI_DECREASEAGI, SCB_AGI|SCB_SPEED);
 	set_sc(AL_CRUCIS, SC_SIGNUMCRUCIS, SI_SIGNUMCRUCIS, SCB_DEF);
@@ -4597,7 +4598,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
 
 	if( bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM )
 	{
-		if( type != SC_SAFETYWALL )
+		if( type != SC_SAFETYWALL && type != SC_PNEUMA )
 			return 0; //Emperium can't be afflicted by status changes
 	}
 
@@ -7060,6 +7061,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
 			case SC_DANCING:
 			case SC_GUILDAURA:
 			case SC_SAFETYWALL:
+			case SC_PNEUMA:
 			case SC_NOCHAT:
 			case SC_JAILED:
 			case SC_ANKLE:
@@ -7216,8 +7218,6 @@ static int status_natural_heal(DBKey key,void * data,va_list ap)
 		if(!vd) vd = status_get_viewdata(bl);
 		if(vd && vd->dead_sit == 2)
 			bonus++;
-		if(map_getcell(bl->m,bl->x,bl->y,CELL_CHKREGEN))
-			bonus++;
 		if(regen->state.gc)
 			bonus++;
 	}

+ 1 - 0
src/map/status.h

@@ -283,6 +283,7 @@ enum sc_type {
 	SC_INCMDEFRATE, // Mdef Potion
 	SC_HPREGEN, // Life Potion
 	SC_INCHEALRATE, // Regeneration Potion
+	SC_PNEUMA,
 	SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
 };
 int SkillStatusChangeTable(int skill);