this is the main problem:
I freeze and get rushed and it says I’m casting invisibility. this happens immediately after I finish being invisible, and lasts until I get killed. this is my gear:

my code is here:
while True:
flag = hero.findFlag("green")
if flag and hero.isPathClear(hero.pos, flag.pos):
hero.move(flag.pos)
elif flag and hero.isReady("jump"):
hero.jumpTo(flag.pos)
if pet.isReady("shape-shift") and not hero.hasEffect("hide"):
pet.shapeShift()
elif hero.isReady("invisibility") and not pet.hasEffect("shape-shift"):
hero.cast("invisibility", hero)
elif hero.isReady("phase-shift"):
hero.phaseShift()
if anyone can help, that’d be great.