'Functional version' broke, cba to fix :)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { mapR } from "./reducers";
|
||||
import { doIf, tap } from "./combinators";
|
||||
import { isLive, setProp, dealDamageToRandom, isReadyToAttack } from "./helpers";
|
||||
import { mapR, pipe } from "./reducers";
|
||||
|
||||
export interface ITank {
|
||||
name: string;
|
||||
@@ -23,7 +23,7 @@ const attack: Attack = (_acc, tank, _iTank, tanks) => {
|
||||
dealDamageToRandom(tanks)
|
||||
)
|
||||
)(tank);
|
||||
return mapR(setProp("attackDelay", tank))(tanks);
|
||||
return mapR(setProp("attackDelay", isReadyToAttack(tank) ? Math.floor(tank.health / 10) : tank.attackDelay - 1))(tanks);
|
||||
};
|
||||
|
||||
type Attacks = (tanks: ITank[]) => ITank[];
|
||||
|
Reference in New Issue
Block a user