Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

some changes, armor timeout most notably

  • Loading branch information...
commit 6e5894279c46543962f39c5ae72b6775861c6c09 1 parent ccc248f
Ryan Karl authored
View
1  .gitignore
@@ -16,3 +16,4 @@ tlogs/
tags
core
saiph.ttyrec
+parallel/
View
1  include/Analyzers/Armor.h
@@ -32,6 +32,7 @@ namespace analyzer {
std::set<unsigned char> _put_on;
bool betterThanCurrent(const Item& item);
+ int loopTimeout;
int calculateArmorScore(const Item& item, const data::Armor* armor);
};
}
View
5 scripts/parallel_repeater
@@ -0,0 +1,5 @@
+#!/bin/sh
+while [ true ]
+export FILE=`date +%s`
+do ./saiph -l -L logs/saiph-$FILE.log
+done
View
5 src/Analyzers/Armor.cpp
@@ -20,7 +20,7 @@ using namespace event;
using namespace std;
/* constructors/destructor */
-Armor::Armor() : Analyzer("Armor"), _put_on() {
+Armor::Armor() : Analyzer("Armor"), _put_on(), loopTimeout(World::turn()) {
/* register events */
EventBus::registerEvent(ChangedInventoryItems::ID, this);
EventBus::registerEvent(ReceivedItems::ID, this);
@@ -148,12 +148,13 @@ void Armor::onEvent(event::Event* const event) {
/* burdened and not beatifying: stash */
} else {
if(e->safeStash()){
+ loopTimeout = World::turn() + 10;
}
}
/* not burdened */
} else {
/* and not on safe stash: pick up */
- if(!e->safeStash()){
+ if(!e->safeStash() && loopTimeout == World::turn()){
/* ^ this also means 'drop at every safe stash if not burdened' */
/* TODO: to avoid this, check whether on upstair, without stashing */
for(map<unsigned char, Item>::iterator i = e->items ().begin(); i != e->items().end(); ++i){
View
1  src/Analyzers/Fight.cpp
@@ -146,6 +146,7 @@ void Fight::analyze() {
* this is a too simple solution, we need to consider stuff as how hard they hit, if they steal
* stuff, if they use wands, etc */
attack_score = m->second.data()->saiphDifficulty();
+ Debug::custom(name()) << "Attack score for monster '" << m->second.data()->name() << ": " << attack_score << endl;
}
int distance = Point::gridDistance(m->first, Saiph::position());
bool floating_eye = (m->second.symbol() == S_EYE && m->second.color() == BLUE);
View
2  src/Analyzers/Weapon.cpp
@@ -77,7 +77,7 @@ void Weapon::onEvent(event::Event* const event) {
/* dropping items or we're burdened (which means don't loot weapons) */
for (map<unsigned char, Item>::iterator i = e->items().begin(); i != e->items().end(); ++i) {
if (e->dropping()) {
- if ((_range_weapons.find(i->first) != _range_weapons.end() || _melee_weapons.find(i->first) != _melee_weapons.end()) && betterThanWhatWeGot(i->second)) {
+ if ((_range_weapons.find(i->first) != _range_weapons.end() || _melee_weapons.find(i->first) != _melee_weapons.end())) {
/* don't drop weapons in one of our lists */
i->second.want(i->second.count());
}
Please sign in to comment.
Something went wrong with that request. Please try again.