Skip to content

Commit

Permalink
Modified the various CanSees to pratise OBSE if the observing unit
Browse files Browse the repository at this point in the history
actually sees a theft or assassination, or spots a stealthy unit
trying to enter the region.  Now ALL skills can be practised!
  • Loading branch information
sgb committed May 8, 2002
1 parent 4d61530 commit c15d957
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
19 changes: 15 additions & 4 deletions faction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ int Faction::CanCatch(ARegion *r, Unit *t)
return 0;
}

int Faction::CanSee(ARegion * r,Unit * u)
int Faction::CanSee(ARegion * r,Unit * u, int practise)
{
int detfac = 0;
if (u->faction == this) return 2;
Expand All @@ -706,10 +706,21 @@ int Faction::CanSee(ARegion * r,Unit * u)
if (u == temp && dummy == 0) retval = 1;
if (temp->faction == this) {
if (temp->GetSkill(S_OBSERVATION) > u->GetSkill(S_STEALTH)) {
return 2;
if (practise) {
temp->Practise(S_OBSERVATION);
temp->Practise(S_TRUE_SEEING);
retval = 2;
}
else
return 2;
} else {
if (temp->GetSkill(S_OBSERVATION)==u->GetSkill(S_STEALTH))
retval = 1;
if (temp->GetSkill(S_OBSERVATION)==u->GetSkill(S_STEALTH)) {
if (practise) {
temp->Practise(S_OBSERVATION);
temp->Practise(S_TRUE_SEEING);
}
if (retval < 1) retval = 1;
}
}
if (temp->GetSkill(S_MIND_READING) > 2) detfac = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions faction.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ class Faction : public AListElem
void RemoveAttitude(int);

int CanCatch(ARegion *,Unit *);
int CanSee(ARegion *,Unit *); /* Return 1 if can see, 2 if can see
faction */
/* Return 1 if can see, 2 if can see faction */
int CanSee(ARegion *,Unit *, int practise = 0);

void DefaultOrders();
void TimesReward();
Expand Down
2 changes: 1 addition & 1 deletion runorders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ AList * Game::CanSeeSteal(ARegion * r,Unit * u)
forlist(&factions) {
Faction * f = (Faction *) elem;
if (r->Present(f)) {
if (f->CanSee(r,u)) {
if (f->CanSee(r,u, Globals->SKILL_PRACTISE_AMOUNT > 0)) {
FactionPtr * p = new FactionPtr;
p->ptr = f;
retval->Add(p);
Expand Down
6 changes: 3 additions & 3 deletions unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,9 @@ int Unit::CanCatch(ARegion *r,Unit *u)
return faction->CanCatch(r,u);
}

int Unit::CanSee(ARegion * r,Unit * u)
int Unit::CanSee(ARegion * r,Unit * u, int practise)
{
return faction->CanSee(r,u);
return faction->CanSee(r,u, practise);
}

int Unit::AmtsPreventCrime(Unit *u)
Expand Down Expand Up @@ -1363,7 +1363,7 @@ int Unit::Forbids(ARegion * r,Unit * u)
{
if (guard != GUARD_GUARD) return 0;
if (!IsAlive()) return 0;
if (!CanSee(r,u)) return 0;
if (!CanSee(r,u, Globals->SKILL_PRACTISE_AMOUNT > 0)) return 0;
if (!CanCatch(r,u)) return 0;
if (GetAttitude(r,u) < A_NEUTRAL) return 1;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class Unit : public AListElem
int Practise(int);
void AdjustSkills();

int CanSee(ARegion *,Unit *); /* Return 1 if can see, 2 if can see
faction */
/* Return 1 if can see, 2 if can see faction */
int CanSee(ARegion *,Unit *, int practise = 0);
int CanCatch(ARegion *,Unit *);
int AmtsPreventCrime(Unit *);
int GetAttitude(ARegion *,Unit *); /* Get this unit's attitude toward
Expand Down

0 comments on commit c15d957

Please sign in to comment.