Shell Trap is a decreased priority move. The user sets up a trap at the beginning of the turn, then executes the move Shell Trap at -3 priority if has been hit by an opponent's physical move this turn. If the user has not been hit by an opponent's physical move at the time it would execute Shell Trap, Shell Trap fails. If the user is hit by Powder, Powder will trigger regardless if hit by a physical attack.
The user being hit by an ally's move or its substitute being hit is not sufficient to allow the move to be used successfully.