Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////////////////
- //Darkpoole - 17/01/2019 (the right way)
- //Redesigned Paladin to have a talent system and get rid of
- //god awful Jihad implementation. My code is cute and you're
- //the one who is wrong.
- //////////////////////////////////////////////////////////////////////////////////
- #include <damage_types.h>
- #include <daemons.h>
- #include <ansi.h>
- #define skill_exist(skill) (SKILL_H->get_tot_base_level(skill,sh_ob) >= 1 ||SKILL_H->get_tot_base_level(skill,sh_ob) == -1)
- #define BGUARD BLK+BOLD
- #define DIV BLU+BOLD
- #define BULW MAG+BOLD
- #define AVGE GRN+BOLD
- object sh_ob;
- string mygod;
- int can_select;
- int _available();
- int * talent_reqs = ({ 7,14,21,28 });
- string * tier_1 = ({"fervor","religion","shield","avenger" });
- string * tier_2 = ({"lay hands","might","divine shield","wrack" });
- string * tier_3 = ({"executioner","martyr","holy-word","harm" });
- string * tier_4 = ({"bloodlust","resurrect","last stand","bless"});
- mapping all_tal = ([ "fervor", "might", "executioner", "bloodlust", "religion", "lay hands",
- "martyr", "resurrect", "shield", "divine shield", "holy-word","last stand","avenger","harm",
- "wrack","bless"]);
- string * all_talents = ({
- "fervor","might","executioner","bloodlust","religion","lay hands","martyr","resurrect", "shield",
- "divine shield","holy-word","last stand","avenger","bless","harm","wrack"});
- int query_talent_slots()
- {
- int my_lev, slots,i,size;
- size = sizeof(all_talents);
- //my_lev = QUESTD->query_quest_points_earned(this_player())/200;
- my_lev = 30;
- if(my_lev > 30)
- {
- my_lev = 30;
- }
- slots = (my_lev / 5);
- for (i = 0; i < size; i ++)
- {
- if(skill_exist(all_talents[i]))
- {
- slots--;
- }
- }
- if(this_player()->query("paladin/talents/harm")) slots--;
- if(this_player()->query("paladin/talents/wrack")) slots--;
- if(this_player()->query("paladin/talents/bless")) slots--;
- if(this_player()->query("paladin/talents/shield")) slots--;
- if(slots < 0) slots = 0;
- return slots;
- }
- void start_shadow (object who) {
- int x;
- if (who->query_paladinshadow() || who->query_subclass_shadow()) {
- destruct(this_object());
- return;
- }
- shadow(who,1);
- sh_ob = who;
- sh_ob->add_hook("pre_death", "class_pre_death");
- add_action("_available","talents");
- add_action("_available","palist");
- add_action("_selecttalent","palearn");
- add_action("_selecttalent","tselect");
- }
- int _available(string str)
- {
- object last;
- string avail1,avail2,avail3,avail4;
- int index, size, size2, size3, size4, i,j,k,l,m,totlevel;
- string msg;
- if (!this_player()->query_is_player())
- return 0;
- if (query_is_war() || this_player()->query_war_player())
- return 0;
- size = sizeof(tier_1);
- size2 = sizeof(tier_2);
- size3 = sizeof(tier_3);
- size4 = sizeof(tier_4);
- avail1 = "";
- avail2 = "";
- avail3 = "";
- avail4 = "";
- totlevel = this_player()->query_total_level();
- if(str == "all")
- {
- tell_object(sh_ob,format(RED+BOLD+sprintf("%|80'='s"," Talents "+RED+BOLD)));
- tell_object(sh_ob,sprintf("%@-16s",({" ","Tier1","Tier2","Tier3","Tier4\n"})));
- tell_object(sh_ob,sprintf(
- "%@-16s",({BGUARD+"\nBlackguard :","[fervor]","[might]","[executioner]","[bloodlust]\n"})));
- tell_object(sh_ob,sprintf(
- "%@-16s",({DIV+"\nHallowed :","[religion]","[lay hands]","[martyr]","[full restore]\n"})));
- tell_object(sh_ob,sprintf(
- "%@-16s",({BULW+"\nBulwark :","[shield]","[divine shield]","[holy-word]","[last stand]\n"})));
- tell_object(sh_ob,sprintf(
- "%@-16s",({AVGE+"\nAvenger :","[Avenger]","[wrack]","[harm]","[bless]\n"})));
- tell_object(sh_ob,format(RED+sprintf(
- "%|80'='s"," Slots Available: "+query_talent_slots()+" "))+NOR);
- return 1;
- }
- for (i = 0; i < size; i ++)
- {
- if (totlevel >= talent_reqs[i] )
- {
- if(skill_exist(tier_1[i])||
- sh_ob->query("paladin/talents/"+tier_1[i]))
- {
- avail1 += "["+tier_1[i]+"*]\n";
- }
- else {
- avail1 += "["+tier_1[i]+"]\n";
- }
- }
- }
- for (i = 0; i < size; i ++)
- {
- if (totlevel >= talent_reqs[i] )
- {
- if(skill_exist(tier_2[i])||
- sh_ob->query("paladin/talents/"+tier_2[i]))
- {
- avail1 += "["+tier_2[i]+"*]\n";
- }
- else {
- avail1 += "["+tier_2[i]+"]\n";
- }
- }
- }
- for (i = 0; i < size3; i ++)
- {
- if (totlevel >= talent_reqs[i] )
- {
- if(skill_exist(tier_3[i]) ||
- sh_ob->query("paladin/talents/"+tier_3[i]))
- {
- avail3 += "["+tier_3[i]+"*]\n";
- }
- else
- {
- avail3 += "["+tier_3[i]+"]\n";
- }
- }
- }
- for (i = 0; i < size4; i ++)
- {
- if (totlevel >= talent_reqs[i] )
- {
- if(skill_exist(tier_4[i])||
- sh_ob->query("paladin/talents/"+tier_4[i]))
- {
- avail4 += "["+tier_4[i]+"*]\n";
- }
- else
- {
- avail4 += "["+tier_4[i]+"]\n";
- }
- }
- }
- tell_object(sh_ob,format(RED+BOLD+sprintf(
- "%|84'='s"," Talents "+RED+BOLD)));
- tell_object(sh_ob,format(RED+sprintf(
- "\n%|75'='s","Slots Available: "+query_talent_slots()+" "))+NOR+"\n");
- tell_object(sh_ob,sprintf(
- "%#-85.5s",CYN+BOLD+"Specilization: \nTier1\nTier2\nTier3\nTier4")+"\n");
- tell_object(sh_ob,sprintf(
- "%#-80.5s",""+BGUARD+"Blackguard : \n"
- +DIV+"Hallowed : \n"+BULW+"Bulwark : \n"+AVGE+"Avenger : \n"+avail1+avail2+avail3+avail4));
- tell_object(sh_ob,format(RED+sprintf(
- "\n%|75'='s","")));
- return 1;
- }
- int _selecttalent(string str)
- {
- int i, size,size2,can_have,totlevel;
- size = sizeof(talent_reqs);
- totlevel = sh_ob->query_total_level();
- if(wildmatch(str,"^(fervor|shield|avenger|religion)$"))
- {
- can_select = 7;
- }
- if(wildmatch(str,"^(might|lay hands|divine shield)$"))
- {
- can_select = 14;
- }
- if(wildmatch(str,"^(executioner|martyr|holy-word)$"))
- {
- can_select = 21;
- }
- if(wildmatch(str,"^(bloodlust|resurrect|last stand)$"))
- {
- can_select = 24;
- }
- if(!str)
- {
- tell_object(sh_ob,"Select Which Talent?\n");
- return 1;
- }
- if(query_talent_slots() == 0)
- {
- tell_object(sh_ob,"No slots left.\n");
- return 1;
- }
- if(str)
- {
- sscanf( str, "%s", str );
- if( !member( all_tal, str ))
- {
- return notify_fail("Not a valid Talent, try again.\n");
- }
- if(skill_exist(str))
- {
- return notify_fail(str+" already exists, please select again.\n");
- }
- if(str == "shield" && totlevel >= can_select)
- {
- this_player()->set("paladin/talents/"+str,1);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- if(str == "avenger"&& totlevel >= can_select)
- {
- this_player()->set("paladin/talents/"+str,1);
- SKILL_H->add_skill(str,1,sh_ob,0);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- if(str == "harm" && totlevel < 16)
- {
- return notify_fail("Not a valid Talent, try again.\n");
- }
- else
- {
- this_player()->set("paladin/talents/"+str,1);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- if(str == "wrack" && totlevel < 23)
- {
- return notify_fail("Not a valid Talent, try again.\n");
- }
- else
- {
- this_player()->set("paladin/talents/"+str,1);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- if(str == "bless" && totlevel < 27)
- {
- return notify_fail("Not a valid Talent, try again.\n");
- }
- else
- {
- this_player()->set("paladin/talents/"+str,1);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- if(totlevel >= can_select)
- {
- SKILL_H->add_skill(str,1,sh_ob,0);
- tell_object(sh_ob,str+" selected, "+query_talent_slots()+" slots left.\n");
- return 1;
- }
- else
- {
- tell_object(sh_ob,"Not a valid Talent, try again.\n");
- return 1;
- }
- }
- }
- void advance_player_level(int level, int hlevel)
- {
- int mylevel;
- mylevel = level + hlevel;
- return sh_ob->advance_player_level(level,hlevel);
- }
- int query_sub_skill_adj(string str)
- {
- return sh_ob->query_sub_skill_adj(str);
- }
- void end_subclass_shadow()
- {
- destruct(this_object());
- }
- string set_no_move( string why, int time )
- {
- return sh_ob->set_no_move(why,time);
- }
- object query_paladinshadow () { return this_object(); }
- detection_types() { return ({ "good", "evil", "magic" }); }
- int valid_wear(string str){
- return str == "shield" || str=="armour" || str=="helmet" || str=="gloves" ||
- str=="boots" || str=="cloak" || str=="amulet" || str == "ring" || str=="ring2" ||
- str=="eyewear" || str== "other";
- }
- int wear(object ob){
- string type;
- int level;
- if(!ob->query("paladin/talents/shield") && ob->query_type()=="shield")
- {
- tell_object(sh_ob,"You have not selected 'Shield' talent, You cannot wear shields.\n");
- return 1;
- }
- else
- {
- return sh_ob->wear(ob,1);
- }
- }
- int
- class_pre_death(string tag, object who, int dam, int type,object killer)
- {
- int count,invuln;
- count = who->query_current_toughness()/10;
- if (type == VORPAL) return 0;
- if(sh_ob->query("paladin/talents/last stand"))
- {
- if(count > random(10))
- {
- tell_object(sh_ob,"Last Stand Message.\n");
- invuln++;
- count--;
- if(count < 0) count = 0;
- sh_ob->heal_self(random(55));
- sh_ob->add_temp("invuln_count", invuln);
- if(sh_ob->query("invuln_count") > count+sh_ob->query_total_level())
- {
- tell_object(sh_ob,"With one last swing, your body gives out in exhaustion.\n");
- tell_object(sh_ob,"You withstood death "+sh_ob->query("invuln_count")+" times.\n");
- return 0;
- }
- return 1;
- }
- }
- }
- query_weapondam_skill(str)
- {
- return sh_ob->query_weapondam_skill(str);
- }
- int query_current_weapondam()
- {
- if(sh_ob->query("mighty"))
- {
- return sh_ob->query_current_weapondam() * 11 / 10;
- } else {
- return sh_ob->query_current_weapondam();
- }
- }
- int valid_harm(string arg)
- {
- if(arg == "mindspin" && mygod == "Mother of All" && (random(5) > 0)) return 0;
- return sh_ob->valid_harm(arg);
- }
- object query_subclass_shadow() {return this_object();}
- int query_current_toughness()
- {
- return sh_ob->query_current_toughness();
- }
- int query_night_sight()
- {
- return sh_ob->query_night_sight();
- }
- query_terrain_mod(string arg) { return sh_ob->query_terrain_mod(arg); }
- string query_mygod() { return mygod; }
- string *query_pose_messages(object who) {
- return ({
- "Holy light cascades from the heavens, blessing the gods' chosen "
- "warrior WHO.",
- "The power of light and good covers the land as WHO prays 'STR'."
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement