To expand step 1)
- (damageToApply and healToApply are the intents with modifiers (boosts, range) already taken into account from the senders but not the reciever.)
- damageReduce is calculated accounting for currently healthy boosted armor parts. (including partially-damaged parts)
- object.hits -= damageToApply + Math.round(damageReduce);
- object.hits += healToApply;
This explanation has to be paraphrasing, read the code if you want a first hand account: https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/tick.js#L7
roncli last edited by
A few issues:
- You can deal on an order of 5 of a resource for 0.001. This is because utils.roundCredits does not round up due to usage of toFixed. Deal cost is calculated correctly (except on subscription tokens, see below).
- There are several unnecessary utils.roundCredits when calculating the deal cost. This is because you are already rounding up the value prior to passing it into utils.roundCredits.
- Orders on subscription tokens are rounded, not rounded up, because this is the only place the dealCost was NOT rounded up prior to sending it into utils.roundCredits.
I'd PR these, but I do not know what your intentions are for these (and the last time I tried to post something about a bug to the repo, I got yelled at ) so I'll let you handle them.