Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loadable skills #25

Merged
merged 29 commits into from
Jan 30, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c3b1916
Loadable skills: Step one: Basic framework: The subtitle
wito Jan 12, 2013
929df3c
Loadable skills: Part Two: The kills.
wito Jan 12, 2013
a6f7e30
Loadable skills: Part three: skill_count()
wito Jan 12, 2013
f6e605a
Defines, operators, accessors.
wito Jan 13, 2013
211064d
New Skill array.
wito Jan 13, 2013
400e636
SkillLevel::comprehension()
wito Jan 13, 2013
230fc8e
Expanded comparators for SkillLevel
wito Jan 13, 2013
3f9b5f2
Significantly upped skill comprehension to better match old values.
wito Jan 13, 2013
8f6f3a6
Fixed an appearance of a ghost skill.
wito Jan 13, 2013
06ae5e8
exposed excercise through an accessor
wito Jan 13, 2013
3465194
display using new method, save and load
wito Jan 13, 2013
1a26777
final display fixes
wito Jan 13, 2013
85443e6
conversion: bionics, books, guns, melee
wito Jan 13, 2013
f965d7c
Merge branch 'master' into loadable-skills
wito Jan 13, 2013
14a1919
traps updated
wito Jan 13, 2013
a7fcaf6
odds and ends
wito Jan 13, 2013
93ffc17
items, melee
wito Jan 13, 2013
7796b11
driving, disarming traps
wito Jan 13, 2013
d7b2a59
savant handling
wito Jan 13, 2013
14e7d28
crafting
wito Jan 13, 2013
d9d9105
cleanup
wito Jan 13, 2013
34831c9
moved skills file into place.
wito Jan 13, 2013
7a51e26
Converted file format to JSON.
wito Jan 13, 2013
505d4a3
moved to references
wito Jan 13, 2013
4f78486
Fixed an off-by-one display error in the character screen.
wito Jan 13, 2013
067e550
Merge branch 'master' into loadable-skills
wito Jan 14, 2013
70051b9
merge branch master into loadable-skills
wito Jan 17, 2013
c1e0814
Further reworked Skill to use pointers.
wito Jan 17, 2013
f975638
Merge branch 'master' into loadable-skills
wito Jan 29, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
items, melee
  • Loading branch information
wito committed Jan 13, 2013
commit 93ffc17f3913ebb7b33698f2077e211c5b669317
2 changes: 1 addition & 1 deletion item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ bool item::has_technique(technique_id tech, player *p)
it_style *style = dynamic_cast<it_style*>(type);
for (int i = 0; i < style->moves.size(); i++) {
if (style->moves[i].tech == tech &&
(p == NULL || p->sklevel[sk_unarmed] >= style->moves[i].level))
(p == NULL || p->skillLevel(Skill::skill("unarmed")) >= style->moves[i].level))
return true;
}
}
Expand Down
50 changes: 25 additions & 25 deletions iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void iuse::royal_jelly(game *g, player *p, item *it, bool t)

void iuse::bandage(game *g, player *p, item *it, bool t)
{
int bonus = p->sklevel[sk_firstaid];
int bonus = p->skillLevel(Skill::skill("firstaid")).level();
hp_part healed;

if (p->is_npc()) { // NPCs heal whichever has sustained the most damage
Expand Down Expand Up @@ -171,7 +171,7 @@ void iuse::bandage(game *g, player *p, item *it, bool t)
refresh();
}

p->practice(sk_firstaid, 8);
p->practice(Skill::skill("firstaid"), 8);
int dam = 0;
if (healed == hp_head)
dam = 1 + bonus * .8;
Expand All @@ -184,7 +184,7 @@ void iuse::bandage(game *g, player *p, item *it, bool t)

void iuse::firstaid(game *g, player *p, item *it, bool t)
{
int bonus = p->sklevel[sk_firstaid];
int bonus = p->skillLevel(Skill::skill("firstaid")).level();
hp_part healed;

if (p->is_npc()) { // NPCs heal whichever has sustained the most damage
Expand Down Expand Up @@ -298,7 +298,7 @@ void iuse::firstaid(game *g, player *p, item *it, bool t)
refresh();
}

p->practice(sk_firstaid, 8);
p->practice(Skill::skill("firstaid"), 8);
int dam = 0;
if (healed == hp_head)
dam = 10 + bonus * .8;
Expand Down Expand Up @@ -698,8 +698,8 @@ void iuse::sew(game *g, player *p, item *it, bool t)
return;
} else if (fix->damage == 0) {
p->moves -= 500;
p->practice(sk_tailor, 10);
int rn = dice(4, 2 + p->sklevel[sk_tailor]);
p->practice(Skill::skill("tailor"), 10);
int rn = dice(4, 2 + p->skillLevel(Skill::skill("tailor")).level());
if (p->dex_cur < 8 && one_in(p->dex_cur))
rn -= rng(2, 6);
if (p->dex_cur >= 16 || (p->dex_cur > 8 && one_in(16 - p->dex_cur)))
Expand All @@ -716,8 +716,8 @@ void iuse::sew(game *g, player *p, item *it, bool t)
g->add_msg_if_player(p,"You practice your sewing.");
} else {
p->moves -= 500;
p->practice(sk_tailor, 8);
int rn = dice(4, 2 + p->sklevel[sk_tailor]);
p->practice(Skill::skill("tailor"), 8);
int rn = dice(4, 2 + p->skillLevel(Skill::skill("tailor")).level());
rn -= rng(fix->damage, fix->damage * 2);
if (p->dex_cur < 8 && one_in(p->dex_cur))
rn -= rng(2, 6);
Expand Down Expand Up @@ -805,9 +805,9 @@ void iuse::scissors(game *g, player *p, item *it, bool t)
if (cut->made_of(COTTON)) {
p->moves -= 25 * cut->volume();
int count = cut->volume();
if (p->sklevel[sk_tailor] == 0)
if (p->skillLevel(Skill::skill("tailor")) == 0)
count = rng(0, count);
else if (p->sklevel[sk_tailor] == 1 && count >= 2)
else if (p->skillLevel(Skill::skill("tailor")) == 1 && count >= 2)
count -= rng(0, 2);
if (dice(3, 3) > p->dex_cur)
count -= rng(1, 3);
Expand Down Expand Up @@ -841,9 +841,9 @@ void iuse::scissors(game *g, player *p, item *it, bool t)
if (cut->made_of(LEATHER)) {
p->moves -= 25 * cut->volume();
int count = cut->volume();
if (p->sklevel[sk_tailor] == 0)
if (p->skillLevel(Skill::skill("tailor")) == 0)
count = rng(0, count);
else if (p->sklevel[sk_tailor] == 1 && count >= 2)
else if (p->skillLevel(Skill::skill("tailor")) == 1 && count >= 2)
count -= rng(0, 2);
if (dice(3, 3) > p->dex_cur)
count -= rng(1, 3);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ void iuse::dig(game *g, player *p, item *it, bool t)
g->add_msg_if_player(p,"You dig a pit.");
g->m.ter (p->posx + dirx, p->posy + diry) = t_pit;
g->m.add_trap(p->posx + dirx, p->posy + diry, tr_pit);
p->practice(sk_traps, 1);
p->practice(Skill::skill("traps"), 1);
} else
g->add_msg_if_player(p,"You can't dig through %s!",
g->m.tername(p->posx + dirx, p->posy + diry).c_str());
Expand Down Expand Up @@ -1463,7 +1463,7 @@ That trap needs a 3x3 space to be clear, centered two tiles from you.");
}

g->add_msg_if_player(p,message.str().c_str());
p->practice(sk_traps, practice);
p->practice(Skill::skill("traps"), practice);
g->m.add_trap(posx, posy, type);
p->moves -= 100 + practice * 25;
if (type == tr_engine) {
Expand Down Expand Up @@ -1943,8 +1943,8 @@ void iuse::manhack(game *g, player *p, item *it, bool t)
p->moves -= 60;
it->invlet = 0; // Remove the manhack from the player's inv
monster manhack(g->mtypes[mon_manhack], valid[index].x, valid[index].y);
if (rng(0, p->int_cur / 2) + p->sklevel[sk_electronics] / 2 +
p->sklevel[sk_computer] < rng(0, 4))
if (rng(0, p->int_cur / 2) + p->skillLevel(Skill::skill("electronics")).level() / 2 +
p->skillLevel(Skill::skill("computer")).level() < rng(0, 4))
g->add_msg_if_player(p,"You misprogram the manhack; it's hostile!");
else
manhack.friendly = -1;
Expand All @@ -1970,8 +1970,8 @@ void iuse::turret(game *g, player *p, item *it, bool t)
}
it->invlet = 0; // Remove the turret from the player's inv
monster turret(g->mtypes[mon_turret], dirx, diry);
if (rng(0, p->int_cur / 2) + p->sklevel[sk_electronics] / 2 +
p->sklevel[sk_computer] < rng(0, 6))
if (rng(0, p->int_cur / 2) + p->skillLevel(Skill::skill("electronics")).level() / 2 +
p->skillLevel(Skill::skill("computer")).level() < rng(0, 6))
g->add_msg_if_player(p,"You misprogram the turret; it's hostile!");
else
turret.friendly = -1;
Expand Down Expand Up @@ -2021,7 +2021,7 @@ void iuse::tazer(game *g, player *p, item *it, bool t)
return;
}

int numdice = 3 + (p->dex_cur / 2.5) + p->sklevel[sk_melee] * 2;
int numdice = 3 + (p->dex_cur / 2.5) + p->skillLevel(Skill::skill("melee")).level() * 2;
p->moves -= 100;

if (mondex != -1) {
Expand Down Expand Up @@ -2262,9 +2262,9 @@ void iuse::vacutainer(game *g, player *p, item *it, bool t)
if (cut->made_of(COTTON)) {
p->moves -= 25 * cut->volume();
int count = cut->volume();
if (p->sklevel[sk_tailor] == 0)
if (p->skillLevel(Skill::skill("tailor")) == 0)
count = rng(0, count);
else if (p->sklevel[sk_tailor] == 1 && count >= 2)
else if (p->skillLevel(Skill::skill("tailor")) == 1 && count >= 2)
count -= rng(0, 2);
if (dice(3, 3) > p->dex_cur)
count -= rng(1, 3);
Expand Down Expand Up @@ -2298,9 +2298,9 @@ if (cut->made_of(COTTON)) {
if (cut->made_of(LEATHER)) {
p->moves -= 25 * cut->volume();
int count = cut->volume();
if (p->sklevel[sk_tailor] == 0)
if (p->skillLevel(Skill::skill("tailor")) == 0)
count = rng(0, count);
else if (p->sklevel[sk_tailor] == 1 && count >= 2)
else if (p->skillLevel(Skill::skill("tailor")) == 1 && count >= 2)
count -= rng(0, 2);
if (dice(3, 3) > p->dex_cur)
count -= rng(1, 3);
Expand Down Expand Up @@ -2385,7 +2385,7 @@ void iuse::lumber(game *g, player *p, item *it, bool t)
item scrap(g->itypes[itm_splinter], int(g->turn), g->nextinv);
p->i_rem(ch);
bool drop = false;
int planks = (rng(1, 3) + (p->sklevel[sk_carpentry] * 2));
int planks = (rng(1, 3) + (p->skillLevel(Skill::skill("carpentry")).level() * 2));
int scraps = 12 - planks;
if (planks >= 12)
planks = 12;
Expand Down Expand Up @@ -2550,7 +2550,7 @@ void iuse::bullet_puller(game *g, player *p, item *it, bool t)
g->add_msg("You do not have that item!");
return;
}
if (p->sklevel[sk_gun] < 2) {
if (p->skillLevel(Skill::skill("gun")) < 2) {
g->add_msg("You need to be at least level 2 in the firearms skill before you\
can disassemble ammunition.");
return;}
Expand Down
Loading