Skip to content

kryft/fsil

Repository files navigation

INTRODUCTION

Fsil is a simple fight simulator for the roguelike Sil (see 
http://www.amirrorclear.net/flowers/game/sil/index.html). Apart from
wanting to get a bit of practical Haskell experience (this is my first actual
program) and play with the probability monad, I wrote Fsil to help me with
important life decisions like the following:

-Which of these two weapons that I just found should I use? 
-Which abilities would help my survival the most right now?
-How risky is it for me to fight this monster in one-on-one combat?
-Can I oneshot this sleeping serpent, or at least confuse it for sufficiently
many turns that I can finish it off safely?

Fsil takes a Sil 1.1.1 character dump file and the name of a monster, and 
simulates probability distributions for a few quantities:

the amount of damage that the player deals to the monster in a single round
(both in terms of absolute damage and as a percentage of the monster's 
maximum hitpoints);
the number of extra damage dice that the player gets from critical hits;
the number of turns of confusion that the player will inflict on the monster
if the player has the ability Cruel Blow;
and the amount of damage that the monster deals to the player in a single blow.

Fsil doesn't try to model every mechanic in Sil combat. When choosing what to
simulate and report, I tried to focus on things that seemed 1) relevant to
some important in-game decision, 2) relatively straight-forward to simulate
accurately based on very limited information (the character dump and the
name of the monster) and 3) not fairly obvious to the (non-expert) player to 
begin with. 

Fsil does model brands, weapon sharpness, resistances, light effects, multiple 
attacks from Rapid Attack or Two Weapon Fighting, some songs (Trees, Staying, 
Sharpness) and some player abilities (Finesse, Power, Subtlety, Hardiness, 
Heavy Armour Use, Assassination, Critical Resistance, Inner Light and Woven 
Themes).

Fsil prints cumulative distribution functions (e.g., the chance of the 
player dealing or suffering at least X damage) and some other information,
such as the player's effective Dark resistance and whether the player is
able to see the monster or not (based on the player's and the monster's
light radius). If a monster has several attacks, data for the attacks is
listed separately.


INSTALLATION

You need the Haskell platform, available from http://www.haskell.org/platform/
for Linux, OS X and Windows. (On Linux you can probably install it directly 
from your distribution's repositories.)

You also need to install the probabilistic programming library from hackage; 
to do this, just enter the following commands at the command line:

> cabal update
> cabal install probability

Finally, to compile Fsil, type

> ghc -O2 --make Fsil.hs

in the Fsil source directory.


USING FSIL

Fsil assumes that there's a valid monster.txt file (the file in 
Sil/lib/edit/ that contains all the monster data in plain text) in the
directory from which you invoke it. The Fsil source directory includes
the monster.txt file from Sil 1.1.1. 

Basic usage is 

> ./Fsil chardumpfile.txt 'name of monster (case-sensitive)'

e.g.

> ./Fsil kryft.txt 'Easterling warrior'

The monster name can also be a case-sensitive POSIX regular expression, so

> ./Fsil kryft.txt 'Easterling w'

or even just

> ./Fsil kryft.txt 'E.*w'

would also work. If no match is found for the monster name (regex) that you 
specified, Fsil will just pit your character against an Orc scout (the first 
monster in monster.txt).

There are also a few command line switches that you can use:

-s SONG[,SONG]  --singing=SONG[,SONG] where SONG = trees | staying | sharpness
Use this to have the player character sing; the effect of the song(s) will be 
calculated using the character's song score listed in the character dump.

If you give two songs separated by a comma, e.g. --singing sharpness,trees
then the second song will use a song score of (Song - 5), as per Woven 
Themes.

-a ALERTNESS    --alertness=ALERTNESS where ALERTNESS = unwary | sleeping
By default monsters are alert; use this to have the monster be unwary or 
asleep.

--plit                    Player is standing on a lit square
--mlit                    Monster is standing on a lit square

By default Fsil assumes that the player and monster are both standing on
unlit dungeon squares.

--minvisible              Force monster to be invisible

By default Fsil assumes that the player can see the monster (unless it's
too dark); it doesn't do perception checks for Sulrauko. Use this to force
the monster to be invisible (to simulate a failed perception check).

--evbonus=EV_BONUS        
--meleebonus=MELEE_BONUS  

Add a (positive or negative) evasion or melee accuracy bonus for the player.

-n N_SAMPLES    --nsamples=N_SAMPLES      
Use this to set the number of samples that are used to simulate probability
distributions; the default is 10000.


For example,

> ./Fsil --singing sharpness -a sleeping kryft.txt 'Sapphire serpent' 

outputs the data for attacking a sleeping Sapphire serpent while singing
Song of Sharpness. 

About

Fight simulator for Sil

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published