Ejemplo n.º 1
0
void RainSensor::sense(){
  #ifdef DEBUGGIN
    Serial.print("Sensing - Use" + String(use));
  #endif
  switch (use) {
    case 0:
          #ifdef DEBUGGIN
            Serial.println("Digital Only ..!!");
          #endif
          if(getDigitalState() == HIGH && isWet == false){
            #ifdef DEBUGGIN
              Serial.println("Fuction when WET is Active");
            #endif
            wet();
            isWet = true;
            isDry = false;
          }
          if(getDigitalState() == LOW && isDry == false){
            #ifdef DEBUGGIN
              Serial.println("Fuction when DRY is Active");
            #endif
            dry();
            isDry = true;
            isWet = false;
          }
    break;

    case 1:
          if(millis() - previusMillis > interval){
            analogValue = analogRead(analogPin);
            analogValue = map(analogValue,0,1023,0,2);
            previusMillis = millis();
          }
    break;

    case 2:
          if(digitalRead(digitalPin) == HIGH && isWet == false){
            wet_CallBack();
            isWet = true;
          }else{
            isWet = false;
          }
          if(digitalRead(digitalPin) == LOW && isDry == false){
            dry_CallBack();
            isDry = true;
          }else{
            isDry = false;
          }

          if(millis() - previusMillis > interval){
            analogValue = analogRead(analogPin);
            analogValue = map(analogValue,0,1023,0,2);
            previusMillis = millis();
          }
    break;
  }
}
Ejemplo n.º 2
0
void weather_effect::light_acid(game *g)
{
 wet(g);
 if (int(g->turn) % 10 == 0 && PLAYER_OUTSIDE) {
  if (!g->u.is_wearing("coat_rain")) {
   g->add_msg("The acid rain stings, but is harmless for now...");
  } else if (one_in(3)) {
   g->add_msg("Your raincoat protects you from the acid rain.");
  }
 }
}
Ejemplo n.º 3
0
void weather_effect::light_acid(game *g)
{
    wet(g);
    if (int(g->turn) % 10 == 0 && PLAYER_OUTSIDE)
    {
        if (!g->u.is_wearing("coat_rain") || !one_in(3))
        {
            g->add_msg("The acid rain stings, but is mostly harmless for now...");
            if (one_in(20) && (g->u.pain < 10)) {g->u.pain++;}
        }
        else
        {
            g->add_msg("Your raincoat protects you from the acidic drizzle.");
        }
    }
}
Ejemplo n.º 4
0
void weather_effect::acid(game *g)
{
 if (PLAYER_OUTSIDE) {
  g->add_msg("The acid rain burns!");
  if (one_in(6))
   g->u.hit(g, bp_head, 0, 0, 1);
  if (one_in(10)) {
   g->u.hit(g, bp_legs, 0, 0, 1);
   g->u.hit(g, bp_legs, 1, 0, 1);
  }
  if (one_in(8)) {
   g->u.hit(g, bp_feet, 0, 0, 1);
   g->u.hit(g, bp_feet, 1, 0, 1);
  }
  if (one_in(6))
   g->u.hit(g, bp_torso, 0, 0, 1);
  if (one_in(8)) {
   g->u.hit(g, bp_arms, 0, 0, 1);
   g->u.hit(g, bp_arms, 1, 0, 1);
  }
 }
 if (g->levz >= 0) {
  for (int x = g->u.posx - SEEX * 2; x <= g->u.posx + SEEX * 2; x++) {
   for (int y = g->u.posy - SEEY * 2; y <= g->u.posy + SEEY * 2; y++) {
    if (!g->m.has_flag(diggable, x, y) && !g->m.has_flag(noitem, x, y) &&
        g->m.move_cost(x, y) > 0 && g->m.is_outside(x, y) && one_in(500))
     g->m.add_field(g, x, y, fd_acid, 1);
   }
  }
 }
 for (int i = 0; i < g->z.size(); i++) {
  if (g->m.is_outside(g->z[i].posx, g->z[i].posy)) {
   if (!g->z[i].has_flag(MF_ACIDPROOF))
    g->z[i].hurt(1);
  }
 }
//CAT-mgs:
// very_wet(g);
 wet(g);
}
Ejemplo n.º 5
0
void weather_effect::light_acid(game *g)
{
    wet(g);
    if (int(g->turn) % 10 == 0 && PLAYER_OUTSIDE)
    {
        if (g->u.weapon.has_flag("RAIN_PROTECT") && one_in(2))
        {
            g->add_msg(_("Your umbrella protects you from the acidic drizzle."));
        }
        else
        {
            if (g->u.is_wearing("coat_rain") && !one_in(3))
            {
                g->add_msg(_("Your raincoat protects you from the acidic drizzle."));
            }
            else
            {
                g->add_msg(_("The acid rain stings, but is mostly harmless for now..."));
                if (one_in(10) && (g->u.pain < 10)) {g->u.pain++;}
            }
        }
    }
}
Ejemplo n.º 6
0
void weather_effect::light_acid(game *g)
{
 wet(g);
 if (int(g->turn) % 10 == 0 && PLAYER_OUTSIDE)
  g->add_msg("The acid rain stings, but is harmless for now...");
}