Exemple #1
0
void
tuple_print(tuple_t tuple, FILE *fp)
{
  unsigned char tuple_type = TUPLE_TYPE(tuple);
  int j;

  fprintf(fp, "%s(", TYPE_NAME(tuple_type));
  for(j = 0; j < TYPE_NOARGS(tuple_type); ++j) {
    void *field = GET_TUPLE_FIELD(tuple, j);

    if (j > 0)
      fprintf(fp, ", ");

    switch(TYPE_ARG_TYPE(tuple_type, j)) {
    case FIELD_INT:
#ifndef BBSIM
      fprintf(fp, "%ld", MELD_INT(field));
#else
      fprintf(fp, "%d", MELD_INT(field));
#endif
      break;
    case FIELD_FLOAT:
      fprintf(fp, "%f", (double)MELD_FLOAT(field));
      break;
    case FIELD_ADDR:
      fprintf(fp, "%p", MELD_PTR(field));
      break;
    case FIELD_LIST_INT:
      fprintf(fp, "list_int[%d][%p]", list_total(MELD_LIST(field)),
	      MELD_LIST(field));
      break;
    case FIELD_LIST_FLOAT:
      fprintf(fp, "list_float[%d][%p]", list_total(MELD_LIST(field)),
	      MELD_LIST(field));
      break;
    case FIELD_LIST_ADDR:
      fprintf(fp, "list_addr[%p]", *(void **)field);
      break;
    case FIELD_SET_INT:
      fprintf(fp, "set_int[%d][%p]", set_total(MELD_SET(field)),
	      MELD_SET(field));
      break;
    case FIELD_SET_FLOAT:
      fprintf(fp, "set_float[%d][%p]", set_total(MELD_SET(field)),
	      MELD_SET(field));
      break;
    case FIELD_TYPE:
      fprintf(fp, "%s", TYPE_NAME(MELD_INT(field)));
      break;
    default:
      assert(0);
      break;
    }
  }
  fprintf(fp, ")");
}
Exemple #2
0
	void CharStats::close_totalstats()
	{
		totalstats[Equipstat::ACC] += calculateaccuracy();

		for (auto iter : percentages)
		{
			Equipstat::Id stat = iter.first;
			int32_t total = totalstats[stat];
			total += static_cast<int32_t>(total * iter.second);
			set_total(stat, total);
		}

		int32_t primary = get_primary_stat();
		int32_t secondary = get_secondary_stat();
		int32_t attack = get_total(Equipstat::WATK);
		float multiplier = damagepercent + static_cast<float>(attack) / 100;
		maxdamage = static_cast<int32_t>((primary + secondary) * multiplier);
		mindamage = static_cast<int32_t>(((primary * 0.9f * mastery) + secondary) * multiplier);
	}
Exemple #3
0
	void CharStats::add_value(Equipstat::Id stat, int32_t value)
	{
		int32_t current = get_total(stat);
		set_total(stat, current + value);
	}
Exemple #4
0
	void CharStats::add_buff(Equipstat::Id stat, int32_t value)
	{
		int32_t current = get_total(stat);
		set_total(stat, current + value);
		buffdeltas[stat] += value;
	}