Please Log in or Create an account to join the conversation.
zusuk wrote: Hey everyone, I'm back in the code hacking away at things
So I wanted to hear people's thoughts on the checks what are "valid" actually better yet, "invalid" targets of a harmful AoE
The stock code is below
Code:/* The skips: 1: the caster * 2: immortals * 3: if no pk on this mud, skips over all players * 4: pets (charmed NPCs) * 5: other players in the same group (if the spell is 'violent') * 6: Flying people if earthquake is the spell */ if (tch == ch) continue; if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) continue; if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(tch)) continue; if (!IS_NPC(ch) && IS_NPC(tch) && AFF_FLAGGED(tch, AFF_CHARM)) continue; if (!IS_NPC(tch) && spell_info[spellnum].violent && AFF_FLAGGED(tch, AFF_GROUP) && AFF_FLAGGED(ch, AFF_GROUP) && ( ((ch->master == NULL) ? ch : ch->master) == ((tch->master == NULL) ? tch : tch->master) ) ) continue; if ((spellnum == SPELL_EARTHQUAKE) && AFF_FLAGGED(tch, AFF_FLYING))
I brainstormed first what would be appropriate "invalids" in a exclusively PKILL mud (since that seemed easiest to brainstorm for me).
* Self
* Immortals flagged with NOHAS
* Certain spell protection (like #6 above, flying for earthquake)
* Same group
* Master
* Charmee
* Charmee of group member
* (Charmee caster) Group member of master
* (Charmee caster) Don't hit charmee of a group member of master
* (Mobile caster) Don't hit other Mobiles unless they are a charmee of a PC
I have two questions for the community. 1) Is this list comprehensive (in respects to a PKILL perspective) and 2) Is there a crafty way of doing all these checks?
I made a new function and this is its current (long) form. I'm still testing it. And as you can see, it doesn't look very crafty
Code:// pass values spellnum // spellnum = spellnum // -1 = no spellnum, no special handling // -2 = tailsweep // return values // 0 = not allowed to hit target // 1 = allowed to hit target int aoeOK(struct char_data *ch, struct char_data *tch, int spellnum) { // skip self - tested if (tch == ch) return 0; // immorts that are nohas - tested if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT && PRF_FLAGGED(tch, PRF_NOHASSLE)) return 0; // earthquake currently doesn't work on flying victims - tested if ((spellnum == SPELL_EARTHQUAKE) && AFF_FLAGGED(tch, AFF_FLYING)) return 0; // tailsweep currently doesn't work on flying victims - tested if ((spellnum == -2) && AFF_FLAGGED(tch, AFF_FLYING)) return 0; // same group, skip - tested if (AFF_FLAGGED(tch, AFF_GROUP) && AFF_FLAGGED(ch, AFF_GROUP) && (((ch->master == NULL) ? ch : ch->master) == ((tch->master == NULL) ? tch : tch->master))) return 0; // don't hit the charmee of a group member - tested if (tch->master) if (AFF_FLAGGED(tch, AFF_CHARM) && AFF_FLAGGED(tch->master, AFF_GROUP) && AFF_FLAGGED(ch, AFF_GROUP) && (((ch->master == NULL) ? ch : ch->master) == (((tch->master)->master == NULL) ? tch->master : (tch->master)->master))) return 0; // charmee, don't hit a group member of master -tested if (ch->master) if (AFF_FLAGGED(ch, AFF_CHARM) && AFF_FLAGGED(ch->master, AFF_GROUP) && AFF_FLAGGED(tch, AFF_GROUP) && (((tch->master == NULL) ? tch : tch->master) == (((ch->master)->master == NULL) ? ch->master : (ch->master)->master))) return 0; // charmee, don't hit a charmee of group member of master if (ch->master && tch->master) if (AFF_FLAGGED(ch, AFF_CHARM) && AFF_FLAGGED(tch, AFF_CHARM) && AFF_FLAGGED(ch->master, AFF_GROUP) && AFF_FLAGGED(tch->master, AFF_GROUP) && ((((tch->master)->master == NULL) ? tch->master : (tch->master)->master) == (((ch->master)->master == NULL) ? ch->master : (ch->master)->master))) return 0; // don't hit your master - tested if (ch->master) if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master == tch) return 0; // don't hit your charmee - tested if (tch->master) if (AFF_FLAGGED(tch, AFF_CHARM) && tch->master == ch) return 0; // npc that isn't charmed shouldn't hurt other npc's if (IS_NPC(ch) && !AFF_FLAGGED(ch, AFF_CHARM) && IS_NPC(tch)) return 0; // PK MUD settings if (CONFIG_PK_ALLOWED) { // !PK settings } else { // if pc cast, !pk mud, skip pc if (!IS_NPC(ch) && !IS_NPC(tch)) return 0; // do not hit pc charmee if (!IS_NPC(ch) && AFF_FLAGGED(tch, AFF_CHARM) && !IS_NPC(tch->master)) return 0; // charmee shouldn't hit pc's if (IS_NPC(ch) && AFF_FLAGGED(ch, AFF_CHARM) && !IS_NPC(ch->master) && !IS_NPC(tch)) return 0; } return 1; }
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
tbaMUD © 2024