Jump to content

Weapon Height from Battle Stance


Quicksilver

Recommended Posts

From the old code, the following is applied to parry_monk, parry, dual_parry, shield_block, blink, block (2h block), dodge, and riposte:

/* check weapon position */
    if (!IS_NPC(ch)){
      /* harder to block for victim if attacker is high */
      if (ch->pcdata->wep_pos == WEPPOS_HIGH)
    chance -= 10;
      /* easier to block for victim if attacker is low */
      else if (ch->pcdata->wep_pos == WEPPOS_LOW)
    chance += 5;
    }
    if (!IS_NPC(victim)){
      /* harder to block for victim if victim is high */
      if (victim->pcdata->wep_pos == WEPPOS_HIGH)
    chance -= 5;
      /* easier to block for victim if victim is low */
      else if (victim->pcdata->wep_pos == WEPPOS_LOW)
    chance += 10;
    }

It doesn't seem to do anything else or apply to any other defense (monk second parry, blur, etc.)

Here is the code behind shield_block:

bool check_shield_block( CHAR_DATA *ch, CHAR_DATA *victim, OBJ_DATA* vir_obj, int dt, int h_roll, int level, bool fVirt, int sn)
{
    OBJ_DATA *obj = NULL;
    OBJ_DATA* obj2 = (vir_obj != NULL? vir_obj : get_eq_char(ch,WEAR_WIELD));

    int chance, ini_chance, temp = 0;
    char buf1[MSL], buf2[MSL], buf3[MSL];
    AFFECT_DATA* paf;

//Sure hit
    if ( !IS_AWAKE(victim)
     || ((paf = affect_find(victim->affected, gsn_wlock)) && paf->modifier != 0)
     || is_affected(victim,gsn_ecstacy))
      return FALSE;
//Skill check
    if ( (chance = get_skill(victim,gsn_shield_block) / 2) == 0)
    return FALSE;
//Item check
    if ( !is_affected(victim, skill_lookup("spirit shield")) && (obj = get_eq_char( victim, WEAR_SHIELD )) == NULL )
        return FALSE;

    ini_chance = chance;


//bonus/penalty for blind.
  //we only check if character can see if this is not virtual attack.
    if (!can_see(ch,victim) && !fVirt)
    {
      if (!IS_NPC(ch) && number_percent() < get_skill(ch,gsn_blind_fighting)){
    if (!is_affected(ch, gsn_battletrance))
      chance *= 1.1;
      }
      else
    chance *= 1.3;
   }

    if (!can_see(victim,ch))
    {
      if (!IS_NPC(victim) && number_percent() < get_skill(victim,gsn_blind_fighting)){
    if (!is_affected(victim, gsn_battletrance))
      chance /= 1.1;
      }
      else
    chance /= 1.3;
    }

/* crusade effects */
    if ( (temp = check_crusade(ch, victim)) != CRUSADE_NONE){
      /* if attacker is on crusade against victim */
      if (temp == CRUSADE_MATCH)
    chance /= 1.3;
      /* if attacker is on crusade but not agaisnt victim */
      else if (temp == CRUSADE_NOTMATCH)
    chance *= 1.1;
    }
    if ( (temp = check_crusade(victim, ch)) != CRUSADE_NONE){
      /* if victim is on crusade against attacker */
      if (temp == CRUSADE_MATCH)
    chance *= 1.3;
      /* if victim is on crusade but not against attacker */
      else if (temp == CRUSADE_NOTMATCH)
    chance /= 1.1;
    }
/* end crusade bonuses */

/* check weapon position */
    if (!IS_NPC(ch)){
      /* harder to block for victim if attacker is high */
      if (ch->pcdata->wep_pos == WEPPOS_HIGH)
    chance -= 10;
      /* easier to block for victim if attacker is low */
      else if (ch->pcdata->wep_pos == WEPPOS_LOW)
    chance += 5;
    }
    if (!IS_NPC(victim)){
      /* harder to block for victim if victim is high */
      if (victim->pcdata->wep_pos == WEPPOS_HIGH)
    chance -= 5;
      /* easier to block for victim if victim is low */
      else if (victim->pcdata->wep_pos == WEPPOS_LOW)
    chance += 10;
    }

    //bonus for bless
    if (obj && IS_GOOD(victim) && IS_OBJ_STAT(obj,ITEM_BLESS))
      chance += 5;
    else if (obj && IS_EVIL(victim) && IS_OBJ_STAT(obj,ITEM_DARK))
      chance += 5;

    chance += get_curr_stat(victim,STAT_STR) - get_curr_stat(ch,STAT_STR);
    chance += get_curr_stat(victim,STAT_DEX) - get_curr_stat(ch,STAT_DEX);
    chance += get_curr_stat(victim,STAT_LUCK) - get_curr_stat(ch,STAT_LUCK);

    if (!IS_NPC(ch) && ch->pcdata->pStallion != NULL && number_percent() < get_skill(ch, gsn_mounted)){
      chance -= 3;
      check_improve(ch, gsn_mounted, TRUE, 1);
    }
    if (IS_NPC(ch) && IS_SET(ch->off_flags, CABAL_GUARD))
    chance -= 10;
    else
        chance += victim->level - level;

    if (!IS_NPC(ch)){
      chance = get_dchance(ini_chance, chance, (h_roll - victim->level/5)/4);
    }
    else
        chance -= h_roll/4;

    if (!IS_NPC(victim) && IS_SET(victim->act2,PLR_GIMP) )
    chance /= 2;

    if ( number_percent( ) >= chance )
        return FALSE;

    if (fVirt)
    {
    /* We select two types of origin of the virual attack.
       1) obj
       2) spell
    */

        sprintf(buf1, "You block a %s's %s with your shield.",
        (vir_obj == NULL? get_vir_attack(sn) : "$p"),
        get_vir_attack(dt));

        sprintf(buf2, "$N blocks a %s's %s with $S shield.",
        (vir_obj == NULL? get_vir_attack(sn) : "$p"),
        get_vir_attack(dt));

        sprintf(buf3, "$N blocks a %s's %s with $S shield.",
        (vir_obj == NULL? get_vir_attack(sn) : "$p"),
        get_vir_attack(dt));
    }
    else
    {
        sprintf(buf1, "You block $n's attack with your shield.");
        sprintf(buf2, "$N blocks your attack with $S shield.");
        sprintf(buf3, "$N blocks $n's attack with $S shield.");
    }

    if (!doomsingerCheck(ch)){
      act( buf1, ch, vir_obj, victim, TO_VICT );
      act( buf2, ch, vir_obj, victim, TO_CHAR );
      act( buf3, ch, vir_obj, victim, TO_WATCHROOM );
    }
    check_improve(victim,gsn_shield_block,TRUE, 0);

//SHBLOCK CHECK
      if (SHBLOCK_CHECK(ch, obj2, obj, dt) == -1)
    bug("Error at: BLOCK_CHECK\n\r", 0);

    return TRUE;
}

Keep in mind that both code snippets are out of date and may not apply to today's FL ( @Erelei has already stated that the defense code presented here is outdated). Still, this old code gives good insight into what goes into defense checks. Notice the mounted penalty and effect of bless. You can also see the role of dex in the calculation for shield block.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...