Exemple #1
0
int eventCast(object who, int level, mixed limbs, object array targets) {
    object target = targets[0];
    int feedback,health,magic,stamina,tot;
    if(!spell::eventCast(who,level,targets)) return 0;
    if( target == who ) {
        //who->eventPrint("You can't cast heal on yourself!");
        //return 0;
    }
    else {
        int hp = who->GetSkillLevel("healing");
        int stam = who->GetSkillLevel("faith");
        send_messages("", "$agent_possessive_noun spell partially heals "
                "$target_name.",who,
                target, environment(target));
        health = target->GetMaxHealthPoints()-target->GetHealthPoints();
        stamina = target->GetMaxStaminaPoints()-target->GetStaminaPoints();
        if(health) target->AddHP(((hp > health) ? health : hp));
        if(stamina) 
            target->AddStaminaPoints(((stam > stamina) ? stamina : stam));
        tot = hp+stam;
        if(tot) 
            who->eventTrainSkill("healing",0,0,1,tot);
        magic = who->GetMagicPoints();
        magic = magic - tot;
        if(magic < 0) feedback = tot - magic;
        who->AddMagicPoints(-tot);
        if(feedback){
            write("Your spell overreached your mana reserves! You suffer "+
                    "from a feedback overload!");
            who->eventReceiveDamage(who, KARMA, tot, 1);
        }
    }
    return 1;
} 
Exemple #2
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;
}
Exemple #3
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}));