Beispiel #1
0
int eventCast(object who, int level, string race, object array targets) {
    class MagicProtection protection;
    object target = targets[0];
    int prot_level, skill, wis;

    wis = who->GetStatLevel("wisdom");
    skill = who->GetSkillLevel("magic defense");
    prot_level = level;
    prot_level *= (random(skill/10) + 1);
    prot_level += random(wis/2);

    protection = new(class MagicProtection);
    protection->bits = BLUNT | BLADE | KNIFE | MAGIC;
    protection->caster = who;
    protection->absorb = 2*prot_level;
    protection->args = level;
    protection->hit = (: hitCallback :);
    protection->end = (: endCallback :);
    target->AddMagicProtection(protection);
    if( target == who ) {
        send_messages("", "A %^BOLD%^CYAN%^translucent magical shield%^RESET%^ "
          "suddenly appears around $agent_possessive_noun body.", who, 0,
          environment(target), 0);
    }
    else {
        send_messages("", "A %^BOLD%^CYAN%^translucent magical shield%^RESET%^ "
          "suddenly appears around $target_possessive_noun body.", who,
          target, environment(target), 0);
    }
    return 1;
}
Beispiel #2
0
int eventBackstab(object backstabber, object target) {
    object env;
    float tmp;
    int suprise;
    object *weapons;
    int numberOfWeapons;
    int numberOfStabs;
    int i;

    if(!backstabber || !(env = environment(backstabber))) return 0;
    if(!target || !present(target, env)) {
        backstabber->eventPrint("Your hapless victim is no longer present.");
        return 1;
    }

    tmp = backstabber->GetSkillLevel("stealth")*1.5;
    tmp += backstabber->GetStatLevel("charisma")/2.0;
    tmp += backstabber->GetStatLevel("luck")/3.0;
    tmp += backstabber->GetMobility()/3.0;
    tmp -= target->GetStatLevel("luck")/3.0;
    tmp -= target->GetStatLevel("wisdom")/3.0;
    tmp -= target->GetMobility()/5.0;
    tmp *= 1.0;
    if(tmp < 1.0) tmp = 1.0;
    suprise = to_int(tmp);

    backstabber->AddSkillPoints("stealth", to_int(suprise * 3.0));
    backstabber->AddStaminaPoints(-(5 + random(5)));
    moral_act(backstabber, target, -30);

    if(suprise < random(100) || !present(target, environment(backstabber))) {
        backstabber->eventPrint("%^RED%^" + target->GetName()
          + " evades your poorly executed backstab.%^RESET%^");
        target->eventPrint("%^RED%^You easily dodge " + possessive_noun(backstabber)
          + " attempted backstab.%^RESET%^");
        environment(backstabber)->eventPrint("%^RED%^" + target->GetName()
          + " dodges " + possessive_noun(backstabber) + " attempted backstab.%^RESET%^",
          ({backstabber, target}));