Automatic evoking of Beauty/Freedom/Sword/SwordII on Inventory

This commit is contained in:
Zeno Rogue 2017-08-14 21:32:02 +02:00
parent 02af85a871
commit b8f7675878
4 changed files with 55 additions and 6 deletions

View File

@ -2485,9 +2485,17 @@ namespace sword {
return ((s2*S42/c2->type - s1*S42/c1->type) + S21 + angle) % S42;
}
void shuffle(int i) {
sword::angle[i] = euclid ? S7*hrand(6) : purehepta ? 3*hrand(S14)+1 : hrand(S42);
}
void reset() {
items[itOrbSword] = items[itOrbSword2] = 0;
shuffle(multi::cpid);
}
void shuffle() {
for(int i=0; i<MAXPLAYER; i++)
sword::angle[i] = euclid ? S7*hrand(6) : purehepta ? 3*hrand(S14)+1 : hrand(S42);
for(int i=0; i<MAXPLAYER; i++) shuffle(i);
}
};

View File

@ -4415,10 +4415,14 @@ bool swordAttack(cell *mt, eMonster who, cell *c, int bb) {
return false;
}
void swordAttackStatic(int bb) {
swordAttack(cwt.c, moPlayer, sword::pos(multi::cpid, bb), bb);
}
void swordAttackStatic() {
for(int bb = 0; bb < 2; bb++)
if(sword::orbcount(bb))
swordAttack(cwt.c, moPlayer, sword::pos(multi::cpid, bb), bb);
swordAttackStatic(bb);
}
void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) {

View File

@ -281,10 +281,47 @@ namespace inv {
string extraline(eItem it, string s) {
return " "+XLAT1(iinf[it].name) + " ("+s+")";
}
void evokeBeautyAt(cell *c) {
forCellEx(c2, c)
if(c2->monst && !isFriendly(c2->monst) && !isIvy(c2->monst)) {
c2->stuntime += 3;
checkStunKill(c2);
}
}
void evokeOrb(eItem it) {
if(it == itOrbFreedom)
for(int i=0; i<numplayers(); i++)
if(multi::playerActive(i))
checkFreedom(playerpos(i));
if(it == itOrbBeauty) {
for(int i=0; i<numplayers(); i++)
if(multi::playerActive(i))
evokeBeautyAt(playerpos(i));
if(items[itOrbEmpathy])
for(cell *c: dcal) if(isFriendly(c->monst))
evokeBeautyAt(c);
}
if(it == itOrbSword || it == itOrbSword2) {
for(int i=0; i<numplayers(); i++)
if(multi::playerActive(i)) {
cwt.c = playerpos(i);
multi::cpid = i;
swordAttackStatic(it == itOrbSword2);
}
}
}
void show() {
if(remaining[itOrbSword]) items[itOrbSword]++;
if(remaining[itOrbSword2]) items[itOrbSword2]++;
gamescreen(2);
if(remaining[itOrbSword]) items[itOrbSword]--;
if(remaining[itOrbSword2]) items[itOrbSword2]--;
cmode = sm::CENTER;
orbcoord.clear();
@ -470,6 +507,7 @@ namespace inv {
if(getOLR(it, getPrizeLand()))
usedForbidden = true;
cwt.c->item = it;
evokeOrb(orbmap[uni]);
checkmove();
popScreenAll();
}

View File

@ -545,7 +545,7 @@ void teleportTo(cell *dest) {
bfs();
items[itOrbSword] = 0;
sword::reset();
items[itOrbSword2] = 0;
if(shmup::on)
shmup::teleported();
@ -568,8 +568,7 @@ void jumpTo(cell *dest, eItem byWhat, int bonuskill = 0, eMonster dashmon = moNo
}
countLocalTreasure();
items[itOrbSword] = 0;
items[itOrbSword2] = 0;
sword::reset();
stabbingAttack(c1, dest, moPlayer, bonuskill);
playerMoveEffects(c1, dest);
if(cwt.c->item != itOrbYendor && cwt.c->item != itHolyGrail)