麻烦多个$ this-> [关闭]

Okay, so I have this dice roller for a site where the code is a ghastly undocumented monster that I'm helping to reconstruct and make a tad more efficient. Now onto the offending code. It reads in $this->willpower and $this->reroll to establish if tick boxes on the site are being used; however, if both willpower and reroll are used at the same time, neither of the strings [specialty] or [WP] appear at the end of the roll.

  public function __construct( $post_ )
  {
    $this->target       = !is_numeric( $post_['target'] ) || $post_['target'] < 2 ||    $post_['target'] > $this->sides ? 6 : $post_['target'];
    $this->number       = $post_['number'] < 1 || $post_['number'] > 30 ? 2 :        $post_['number'];
    $this->willpower    = isset( $post_['willpower'] ) ? true : false;
    $this->reroll       = isset( $post_['reroll'] ) ? true : false;
  }

The offending code seems to be:

   if( $dice_roll == 10 && $this->reroll){
     $this->text[] = '[Specialty]';
   }

   if( $this->willpower ){
     $this->text[] = '[WP]';
   }

Can anyone offer suggestions as to why this error occurs?

Clarification: The final output of this program is something like Roll: 12 d10 TN6 (3, 5, 5, 5, 7, 7, 7, 7, 9, 9, 10, 10) ( success x 10 ) [Specialty] VALID or Roll: 12 d10 TN6 (3, 5, 5, 5, 7, 7, 7, 7, 9, 9, 10, 10) ( success x 10 ) [WP] VALID Depending on what's checked via the user input. However if both specialty and WP are used, neither [specialty] or [WP] shows at the end of the roll.

I think you need

if( $dice_roll == 10 && $this->reroll) {
    $this->text[] = '[Specialty]';
} else if( $this->willpower ) {
    $this->text[] = '[WP]';
}

or

if( $this->willpower ) {
    $this->text[] = '[WP]';
} else if( $dice_roll == 10 && $this->reroll) {
    $this->text[] = '[Specialty]';
}

It depend on what result you expect - [WP] or [Specialty]