Welcome to the Builder Academy

Question How to Update Bard Songs to work outside of combat

More
24 Apr 2023 03:58 #10321 by Nero
I would like for my bard class to be able to cast certain songs outside of combat that normally have to be cast while in combat.
If they, and/or their group, is not in combat the song will still provide the buffs however I want it to be where if the tick times down and they do not engage in battle, then the buff wears off.
Code:
ACMD(do_song_group3) {   struct char_data *tch, *k;   struct follow_type *f, *f_next;   int percent, prob, percentsonc, probsonc, inspiretick;   if (ch == NULL)     return;   if ((IS_NPC(ch)) && (AFF_FLAGGED(ch, AFF_CHARM))) {     act("$n looks puzzled.", FALSE, ch, 0, 0, TO_ROOM);     return;   }   if (!IS_NPC(ch) && !GET_TOT_SKILL(ch, SKILL_SONG_GROUP3)) {     send_to_char(ch, "%s", NOPROFICIENCY);     return;   }   if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {     send_to_char(ch, "%s", PEACE_ROOM_WARNING);     return;   }   if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF)) {     send_to_char(ch, "The accoustics in this area are too poor to sing effectively.\r\n");     return;   }   if (GET_MANA(ch) <= 19) {     send_to_char(ch, "You haven't the energy to sing that song!\r\n");     return;   }   if (GET_MOVE(ch) <= 9) {     send_to_char(ch, "Your movement points are too low to sing that song!\r\n");     return;   }   if (!AFF_FLAGGED(ch, AFF_GROUP)) {     send_to_char(ch, "You have no group to inspire!\r\n");     return;   }   if (AFF_FLAGGED(ch, AFF_SILENCE)) {     send_to_char(ch, "You vocal cords are too tight to sing!\r\n");     return;   }     if (!FIGHTING(ch)) {     send_to_char(ch, "You feel temporarily inspired by song!\r\n");     return;     }     if ((IS_SET(MSC2_FLAGS(ch), MSC2_SANG_GROUP)) || (IS_SET(MSC2_FLAGS(ch), MSC2_SONG_GROUP1)) ||        (IS_SET(MSC2_FLAGS(ch), MSC2_SONG_GROUP2))  || (IS_SET(MSC2_FLAGS(ch), MSC2_SONG_GROUP3))) {     send_to_char(ch, "You are not yet prepared to consider another melody right now.\r\n");     return;     }   percent = rand_number(1, 20);    /* 101% is a complete failure */   prob = 25;   if ((percent + ((GET_TOT_CHA(ch)) / 2)) >= (prob)) {       send_to_char(ch, "@gYou calmly close your eyes and begin to sing, the notes that follow fall flat.@n\r\n");       act("@g$n calmly closes $s eyes and begins to sing, but all you hear is a dull, flat melody.@n", FALSE, ch, 0, ch, TO_ROOM);           GET_MANA(ch) -= 10;           GET_MOVE(ch) -= 5;         GET_WAIT_STATE(ch) = 1 * PULSE_VIOLENCE;       if (rand_number(1, 101) < SG_MIN)         skill_gain(ch, SKILL_SONG_GROUP3);       return; }   if ((percent + ((GET_TOT_CHA(ch)) / 2)) < (prob)) {       send_to_char(ch, "@GYou calmly close your eyes and begin to sing a war sonnet...@n\r\n");       act("@G$n calmly closes $s eyes and begins to sing a war sonnet...@n", FALSE, ch, 0, ch, TO_ROOM);         GET_MANA(ch) -= 20;         GET_MOVE(ch) -= 10;         GET_WAIT_STATE(ch) = 1 * PULSE_VIOLENCE; }   if (ch->master != NULL)     k = ch->master;   else     k = ch;     {   for (f = k->followers; f; f = f_next) {     f_next = f->next;     tch = f->follower;     if (IN_ROOM(tch) != IN_ROOM(ch))         continue;     if (!AFF_FLAGGED(ch, AFF_GROUP)) {     send_to_char(ch, "You have no group to inspire!\r\n");       return;     }     if (!AFF_FLAGGED(tch, AFF_GROUP)) {       continue;     }     if (!FIGHTING(tch)) {     send_to_char(tch, "@gYou and your group must be in battle to be inspired!@n\r\n");     continue;     }   if ((IS_SET(MSC2_FLAGS(tch), MSC2_SANG_GROUP)) || (IS_SET(MSC2_FLAGS(tch), MSC2_SONG_GROUP1)) ||        (IS_SET(MSC2_FLAGS(tch), MSC2_SONG_GROUP2))  || (IS_SET(MSC2_FLAGS(tch), MSC2_SONG_GROUP3))) {     send_to_char(ch, "Your group is not ready to hear another song.\r\n");     return;     }          if (GET_RESIST(tch, RESIST_TYPE_SONC) >= 100) {             send_to_char(ch, "Your friend is deaf, they will never hear you.\r\n");             continue;          }          if (GET_RESIST(tch, RESIST_TYPE_SONC) <= 99) {              percentsonc = rand_number(1, 99);              probsonc = (GET_RESIST(tch, RESIST_TYPE_SONC));                if (percentsonc < probsonc) {             send_to_char(ch, "Your friend couldn't hear you, perhaps you should sing louder.\r\n");             continue;                }          }     if (ch == tch)       continue; /* If the Bard is the Leader of the Group */     SET_BIT(MSC2_FLAGS(tch), MSC2_SONG_GROUP3);     SET_BIT(MSC2_FLAGS(tch), MSC2_SANG_GROUP);     SET_BIT(MSC2_FLAGS(ch), MSC2_SONG_GROUP3);     SET_BIT(MSC2_FLAGS(ch), MSC2_SANG_GROUP);     SET_BIT(MSC2_FLAGS(k), MSC2_SONG_GROUP3);     SET_BIT(MSC2_FLAGS(k), MSC2_SANG_GROUP);     if (ch != tch) {             send_to_char(tch, "@GYou feel inspired!@n\r\n");   }     if ((ch == tch) || (k != ch)) {             send_to_char(ch, "@GYou feel inspired!@n\r\n");   }   } /* If the Bard is not the Leader of the Group */   if ((k != ch) && AFF_FLAGGED(k, AFF_GROUP))     SET_BIT(MSC2_FLAGS(ch), MSC2_SONG_GROUP3);     SET_BIT(MSC2_FLAGS(ch), MSC2_SANG_GROUP);     SET_BIT(MSC2_FLAGS(k), MSC2_SONG_GROUP3);     SET_BIT(MSC2_FLAGS(k), MSC2_SANG_GROUP);     send_to_char(k, "@GYou feel inspired!@n\r\n");     return; } }

Please Log in or Create an account to join the conversation.

Time to create page: 0.168 seconds